Make a click event stop with off() - Javascript jQuery

Javascript examples for jQuery:Mouse Event

Description

Make a click event stop with off()

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://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script> 
  <script type="text/javascript">
    $(window).load(function(){/*from   w  w  w.  jav  a 2s.com*/
$('a.remove_item').on('click',function(e) {
    console.log('clicked');
   $('a.remove_item').off('click');
});
    });

      </script> 
 </head> 
 <body> 
  <a class="remove_item">click me!</a>  
 </body>
</html>

Related Tutorials