How to write HTML code dynamically using JavaScript?


The innerHTML property is used to write the HTML code using JavaScript dynamically. Let’s see a simple example:

document.getElementById('mylocation').innerHTML="<h2>This is heading using JavaScript</h2>"; 

Leave a Reply

Your email address will not be published. Required fields are marked *