Skip to content

Instantly share code, notes, and snippets.

@interactiveRob
Created May 1, 2018 16:45
Show Gist options
  • Save interactiveRob/cdbe4b5869cd40a41685928a7108e814 to your computer and use it in GitHub Desktop.
Save interactiveRob/cdbe4b5869cd40a41685928a7108e814 to your computer and use it in GitHub Desktop.
jQuery prevent all link clicks on a page
$('a').each(function(){
$this = $(this);
$this.click(function(e){
e.preventDefault();
});
});
@interactiveRob
Copy link
Author

You can use this function in the console to prevent all link clicks from reaching their target page. Useful for testing GTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment