Skip to content

Instantly share code, notes, and snippets.

@wteuber
Last active December 15, 2015 06:58
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 wteuber/5219671 to your computer and use it in GitHub Desktop.
Save wteuber/5219671 to your computer and use it in GitHub Desktop.
Find contradicting click events on links and submits.
/*Run this code in your js console after the page has been loaded completely*/
/* "!== undefined" at the end simply prevents unwanted output in the js console.*/
$('a').each(function () {
var self = $(this);
if ((self.attr('href') && self.attr('href').indexOf('#') !== 0) && (self.data('events') !== undefined) && (self.data('events').click !== undefined)) {
console.log(this, self.attr('href'), self.data('events'))
}
}) !== undefined
$('[type="submit"]').each(function () {
var self = $(this);
if ((self.data('events') !== undefined) && (self.data('events').click !== undefined)) {
console.log(this, self.data('events'))
}
}) !== undefined
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment