Skip to content

Instantly share code, notes, and snippets.

@tommcfarlin tommcfarlin/00-example.js Secret
Created Feb 16, 2018

Embed
What would you like to do?
[JavaScript] Dynamic Elements, Static Elements, Event Handlers and Their Complexities
$('.acme-element').each(function(e) {
var $anchor = $(this).parents('a');
$(this).on('click', function(evt) {
if(e.target !== this) {
evt.preventDefault();
}
// Here, you may want to action to redirect to an original anchor.
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.