delete itself after execution - Javascript jQuery Method and Property

Javascript examples for jQuery Method and Property:jQuery Method Example

Description

delete itself after execution

Demo Code

ResultView the demo in separate window

<html>
 <head> 
  <meta name="viewport" content="width=device-width, initial-scale=1"> 
  <script type="text/javascript" src="https://code.jquery.com/jquery-compat-git.js"></script> 
 </head> //from   w  w  w  .j  a v a2 s .  com
 <body> 
  <button>remove</button> 
  <script id="test">
$( "button" ).click(function() {
  $( "#test" ).remove();
  console.log("removed " + ($( "#test" ).length == 0));
});

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

Related Tutorials