Set innerHTML to text value - Javascript DOM

Javascript examples for DOM:Element innerHTML

Description

Set innerHTML to text value

Demo Code

ResultView the demo in separate window

<html>
   <head> 
      <title>innerHTML test</title> 
      <script>
  function doIt(){/*from   w  w  w . j  av a 2s.  c o m*/
    document.getElementById("header-text").innerHTML = "something interesting";
  }

      </script> 
   </head> 
   <body> 
      <div id="header-text" class="picture-text">
          Static text 
      </div> 
      <input type="button" value="Change It" onclick="doIt();">
      <br>  
   </body>
</html>

Related Tutorials