innertext innerhtml js code example
Example 1: .innerhtml
// .innerHTML method is used to change the html contents of a DOM object
document.getElementById("demo").innerHTML = "Paragraph changed!";
Example 2: javascript innertext vs innerhtml
innerHTML shows everything inside of the element.
innerText shows only the text inside of the element.