Delete div Element from page - Javascript DOM HTML Element

Javascript examples for DOM HTML Element:Div

Description

Delete div Element from page

Demo Code

ResultView the demo in separate window

<html>
   <head> 
      <meta name="viewport" content="width=device-width, initial-scale=1"> 
   </head> 
   <body>   
      <form> 
         <br> 
         <input id="myElement" value="Remove me clicking on the button below" size="100"> 
      </form> 
      <br> 
      <button onclick="myFunction()">Remove input</button> 
      <script>
function myFunction() {/*from  ww w. jav  a 2s  . c om*/
    var x = document.getElementById("myElement");
    x.remove();
}

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

Related Tutorials