'createElement()' Example : createElement « Node Operation « JavaScript DHTML






'createElement()' Example

 
    
<html>
<body>
<script language="javascript">
function function1(){
   var myElement = document.createElement('<hr>');
   myBody.appendChild(myElement);
}
</script>
<body id="myBody">
<button onClick="function1();">Put horizontal rule</button>
</body>
</html>

    
      
        
  








Related examples in the same category

1.Append paragraph tag to body tag