Created
January 16, 2015 20:23
-
-
Save gapple/fa099f258601a955e160 to your computer and use it in GitHub Desktop.
Show HTML elements with duplicated IDs in the console
This file contains hidden or 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
// @see http://stackoverflow.com/a/509965/120080 | |
(function ($) { | |
$('[id]').each(function () { | |
var ids = $('[id="'+this.id+'"]'); | |
if(ids.length>1 && ids[0]==this) { | |
console.warn('Multiple IDs #'+this.id); | |
console.group(); | |
ids.each(function () { | |
console.info(this); | |
}); | |
console.groupEnd(); | |
} | |
}); | |
})(jQuery); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment