Created
January 12, 2017 16:58
-
-
Save GLMeece/1521d6ab6e0a5026233b8f77c38dcb96 to your computer and use it in GitHub Desktop.
Find Duplicate IDs on a Web Page
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
javascript:(function () { | |
var ids = {}; | |
var found = false; | |
$('[id]').each(function() { | |
if (this.id && ids[this.id]) { | |
found = true; | |
console.warn('Duplicate ID #'+this.id); | |
} | |
ids[this.id] = 1; | |
}); | |
if (!found) console.log('No duplicate IDs found'); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment