Skip to content

Instantly share code, notes, and snippets.

@Shridhad
Last active January 3, 2016 00:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Shridhad/8383216 to your computer and use it in GitHub Desktop.
Save Shridhad/8383216 to your computer and use it in GitHub Desktop.
Stop repeating event.preventDefult();
$(document).ready(function() {
function defaultPreventer(handler) {
return function(event) {
alert("preventing default");
event.preventDefault();
handler.apply(this, arguments);
}
};
function clickHandler(event) {
alert("Click Handler");
};
$("#link").on("click", defaultPreventer(clickHandler));
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment