I have a button
<input type="button" id="myButton"/>
with many click events
$("#mybutton").on("click", function(){ console.log("do something 1")} );
$("#mybutton").on("click", function(){ console.log("do something 2")} );
$(document).on("click","#mybutton" function(){ console.log("do something 3")} );
I need new click event handling before other click event, and other events handle after success ajax.
$(document).on("click","#mybutton" function(){
pauseOtherClickEvents();
$ajax(success:{continueOtherClickEvents()});
} );
Is possible solution in jQuery or pure javascript?
var benable = true;
$("#mybutton").on("click", function(){ if(benable) {console.log("do something 1")} } );
$("#mybutton").on("click", function(){ if(benable) {console.log("do something 2")} } );
$(document).on("click","#mybutton" function(){ if(benable) {console.log("do something 3")} } );
$(document).on("click","#mybutton" function(){
benable = false;
$ajax(success:{ benable = true});
} );
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.