Skip to content

Instantly share code, notes, and snippets.

@gapple
Created January 16, 2015 20:23
Show Gist options
  • Save gapple/fa099f258601a955e160 to your computer and use it in GitHub Desktop.
Save gapple/fa099f258601a955e160 to your computer and use it in GitHub Desktop.
Show HTML elements with duplicated IDs in the console
// @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