Create <h1> element and assign its text - Javascript DOM HTML Element

Javascript examples for DOM HTML Element:Heading


Create <h1> element and assign its text

Demo Code

ResultView the demo in separate window

      <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";

      <div id="divone"> 

Related Tutorials