Set property 'innerHTML' of div - Javascript DOM HTML Element

Javascript examples for DOM HTML Element:Div

Description

Set property 'innerHTML' of div

Demo Code

ResultView the demo in separate window

<!doctype html>
<html>
   <head> 
      <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> 
      <title>Example</title> 
   </head> 
   <body> 
      <div id="hello"></div> 
      <script type="text/javascript">
    what();//  www .  j av  a 2s .co m
    function what(){
        document.getElementById('hello').innerHTML = '<p>hi</p>';
    };

      </script>  
   </body>
</html>

Related Tutorials