, , "div", "p" . "divs", "p" , "p" .
One way around this is to use a delegate:
$(document).delegate("p", "click", function () { /* do stuff */ });
Another way is to untie existing handlers and then reformat them:
$("p").off();
$("p").on("click", function () { });
The third way is to use dirty flags (which should be set as global, which is not entirely accurate) to check if the handler for this call is working:
$("p").on("click", function () {
if (flag) {
return;
} else {
flag = true;
doStuff();
flag = false;
}
});
source
share