+ 1
JavaScript
What is the purpose of inner.HTML? Thank you~
7 Réponses
0
innerHTML = "Some new text"
innerText = "Some new text"
TextContent = "Some new text"
and
document.createTextNode("Some new text")
All of these add text to an HTML element
to better understand look at my code, it's all coded using JS no HTML or CSS
https://code.sololearn.com/W5XYF137A18u/?ref=app
+ 9
innerHTML - lets you edit the HTML inside an element on your page.
+ 6
It returns everything inside an element. It will return not only the text, but also the tags and attributes
+ 1
If you mean innerHTML ( without point) is how you access the text of the label, span and others ( not input).
+ 1
Yes. Jax is correct. My bad.
+ 1
The property textContent is very practical for text, because in practice, when accessing the text content of an element, one is often not interested in whether and which additional markings were used.
+ 1
Thank you guys!