Why Does Changing Innertext Value Also Changes Innerhtml?
I have a asp.net code that creates a button as follows:
So for example, if you did this:
var div = document.createElement('DIV');
div.innerText = '<span>Hello</span>';
document.body.appendChild(div);
Then you'd actually see the string "<span>Hello</span>"
on the screen, as opposed to "Hello"
(inside a span).
There are some other subtleties to innerText
as well, which are covered in the MDN article referenced above.
Post a Comment for "Why Does Changing Innertext Value Also Changes Innerhtml?"