0

Please guys when do I use .innerHtml, .value and .innertext in javascript to change html ?

Changing html tags contents

21st Sep 2022, 5:23 PM
Omosanya Damilola
2 Réponses
+ 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
21st Sep 2022, 5:29 PM
Lisa
Lisa - avatar
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.
22nd Sep 2022, 11:19 AM
ALI Moussa Kadjalla
ALI Moussa Kadjalla - avatar