innerhtml
snippet in html

innerHTML

user3770

document.getElementById("Test").innerHTML = "<h1>Test</h1>"; 

innerHTML

user5548


document.getElementById("demo").innerHTML = "";  // Replaces the content of <p> with an empty string 

innerHTML

user7441

document.getElementById("Test").innerHTML = "<h1>Test</h1>";

innerHTML

user5442


 var x = document.getElementById("myList").innerHTML; 

innerHTML

user877


 document.getElementById("myP").innerHTML = "Hello Dolly.";

 document.getElementById("myDIV").innerHTML = "How are you?"; 

innerHTML

user710


 alert(document.getElementById("demo").innerHTML); 

innerhtml

user5433


<html>

<body>


<p id="p1">Hello World!</p>


<script>

document.getElementById("p1").innerHTML = "New text!";

</script>


</body>

</html>