Javascript examples for DOM HTML Element:Heading
Create <h1> element and assign its text
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <script type="text/javascript"> window.onload=function(){//from ww w . j a va 2s. co m var example = document.getElementById('divone'); var h1 = document.createElement('h1'); h1.innerText = "hi"; example.appendChild(h1); } </script> </head> <body> <div id="divone"> </div> </body> </html>