Answers for "javascript write to document innerhtml or innertext"

3

HTML DOM innerText

var x = document.getElementById("myBtn").innerText;
Posted by: Guest on February-28-2021
1

innerhtml in javascript

<p id="demo" class="demo_class"></p>

<script>
//simple
document.getElementById("demo").innerHTML = "hello World";

//advance
document.getElementById("demo").innerHTML = person("ahsan", "21");

function person(name1, age1) {
    return ("Your name is " + name1 + ". You're " + age1 + " years old.");
}

</script>
Posted by: Guest on June-04-2021
2

javascript innertext vs innerhtml

innerHTML shows everything inside of the element.
innerText shows only the text inside of the element.
Posted by: Guest on October-04-2020

Code answers related to "javascript write to document innerhtml or innertext"

Browse Popular Code Answers by Language