Say I have something like the following to trap the click event of a button:
$(\"#button_id\").click(function() { //disable click event //do something
This example work.
HTML code:
Something
jQuery:
var fade = function(){ $(".mask").fadeToggle(500,function(){ $(this).parent().on("click",function(){ $(this).off("click"); fade(); }); }); }; $(".wrapper").on("click",function(){ $(this).off("click"); fade(); });