Last active
January 3, 2016 03:29
-
-
Save tytskyi/8402526 to your computer and use it in GitHub Desktop.
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
(function ($) { | |
var ids = [], | |
sorted = [], | |
repeated = []; | |
$('[id]').each(function () { | |
ids.push(this.id); | |
}); | |
var sorted = ids.sort(); | |
for (var i = 0; i < ids.length - 1; i++) { | |
if (sorted[i + 1] == sorted[i]) { | |
repeated.push(sorted[i]); | |
} | |
} | |
repeated.length && console.log('Duplicated IDs(' + repeated.length +'): ' + repeated); | |
})(jQuery); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment