0
Please guys when do I use .innerHtml, .value and .innertext in javascript to change html ?
Changing html tags contents
2 Answers
+ 4
value can only be applied if the element has a value attribute (input tags!)
On the difference of innerHtml, innerText, textContent:
https://medium.com/front-end-weekly/javascript-innerhtml-innertext-and-textcontent-b75ec895cbe3
0
innerText:
We can not insert the HTML tags.
It returns text without an inner element tag.
It ignores the spaces.
innerHTML:
We can insert the HTML tags.
It returns a tag with an inner element tag.
It considers the spaces.