Why Innertext,innerhtml Property Doesnt Work On Input Tags In Javascript?
So i stumbled upon following code Name:
Click the button to change t
Solution 1:
Because inner refers to the content that is "in between" the opening and closing tags of an element. For example:
<p>This is the "innerText" or "textContent"</p>
The <input> element doesn't have a closing tag, so it can never contain any "inner" content. For these elements, use the .value property to access their content.
There are other elements that do not have a closing tag, but in the following cases, the elements don't have innerText or .value because they are not designed to store any data, only to have a semantic or structural effect on the HTML:
<area><base><br><col><colgroup>when the span is present<command><embed><hr><img><input><keygen><link><meta><param><source><track><wbr>
Post a Comment for "Why Innertext,innerhtml Property Doesnt Work On Input Tags In Javascript?"