Delete all input element - Javascript DOM HTML Element

Javascript examples for DOM HTML Element:Form Event

Description

Delete all input element

Demo Code

ResultView the demo in separate window

<html>
   <head> 
      <meta name="viewport" content="width=device-width, initial-scale=1"> 
      <script type="text/javascript">
    window.onload=function(){/*from   w  w  w  .  j a va2s  .  c o m*/
var btn = document.getElementById('btn');
btn.onclick = function () {
    document.getElementById('txt').remove();
    this.remove();
};
    }

      </script> 
   </head> 
   <body> 
      <p id="txt">Can i put it here?</p> 
      <input id="btn" type="submit" value="REMOVE THAT!!!">  
   </body>
</html>

Related Tutorials