js get innerHTML code example
Example 1: change innerhtml
document.getElementById("p1").innerHTML = "New text!";
Example 2: .innerhtml
document.getElementById("demo").innerHTML = "Paragraph changed!";
Example 3: javascript innerhtml
document.getElementById("example").innerHTML = "Paragraph changed!";
Example 4: js innerHTML
document.getElementById("Test").innerHTML = "<p style='color:red;'>Test</p>";
Example 5: innerhtml in javascript
<p id="demo" class="demo_class"></p>
<script>
document.getElementById("demo").innerHTML = "hello World";
document.getElementById("demo").innerHTML = person("ahsan", "21");
function person(name1, age1) {
return ("Your name is " + name1 + ". You're " + age1 + " years old.");
}
</script>