+ 2
InnerHTML
what is innerHTML and what it does? what's its purpose?
4 Answers
+ 19
The innerHTML property sets or returns the HTML content (inner HTML) of an element.
Learn more:
https://www.w3schools.com/jsref/prop_html_innerhtml.asp
https://developer.mozilla.org/en-US/docs/Web/API/Element/innerHTML
+ 8
https://www.sololearn.com/learn/JavaScript/2752/
+ 5
it sets the inner text of an element
<p>hello</p>
<script>
document.querySelector("p").innerHTML="Hy";
see what happens here is the text in that p element which was once hello is now hy
that is:<p>Hy</p>
+ 2
Equals the HTML between the target elements open and closing tags.