innerhtml javascript example

Dynamic content example using innerHTML. If you’re just inserting plain text that doesn’t contain any HTML tags, use textContent instead. function getMyOutput() document.getElementById("id1").innerHTML = "First Header"; This is a desktop browser we're talking about! scriptNode.innerHTML = code didn't work for IE. The only thing to do is replace with scriptNode.text = code and it work fine First, we give the HTML element a unique id. function ShowMessage () {. Code Examples. Object.innerHTML = value. Suppose that you have the following markup: The following example uses the innerHTML property to get the content of the