Skip to content

Instantly share code, notes, and snippets.

@tommcfarlin
Created February 16, 2018 16:53
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 tommcfarlin/c2d33cce48603de444d2a620927f32da to your computer and use it in GitHub Desktop.
Save tommcfarlin/c2d33cce48603de444d2a620927f32da to your computer and use it in GitHub Desktop.
[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