+ 1
Why won't it recognise "innerHTML"?
2 ответов
0
https://code.sololearn.com/WO5NLcQ1470e/?ref=app
0
In JS this:
document.getElementById("but").innerHTML
searched an element from the HTML document, which has an id attribute assigned to "but".
(
Example of tag with id attribute assigned to "but":
<example id="but"> </example>
)
Because there was no such element with that id in the HTML document, JS method "getElementById" returned null, which you tried to give a value:
null = "something"; //error