Last active
January 3, 2016 00:29
-
-
Save Shridhad/8383216 to your computer and use it in GitHub Desktop.
Stop repeating event.preventDefult();
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(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