jQuery - How can I temporarily disable the onclick event listener after the event has been fired?
        Posted  
        
            by 
                aldux
            
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by aldux
        
        
        
        Published on 2009-12-17T13:39:12Z
        Indexed on 
            2012/10/12
            9:38 UTC
        
        
        Read the original article
        Hit count: 300
        
How can I temporarily disable the onclick event listener, (jQuery preferred), after the event has been fired?
Example:
After the user clicks on the button and fires this function below, I want to disabled the onclick listener, therefore not firing the same command to my django view.
$(".btnRemove").click(function(){
   $(this).attr("src", "/url/to/ajax-loader.gif");
   $.ajax({
        type: "GET",
        url: "/url/to/django/view/to/remove/item/" + this.id,
        dataType: "json",
        success: function(returned_data){
            $.each(returned_data, function(i, item){
              // do stuff                       
     });
   }
});
Thanks a lot,
Aldo
© Stack Overflow or respective owner