Skip to content

Instantly share code, notes, and snippets.

@tytskyi
Last active January 3, 2016 03:29
Show Gist options
  • Save tytskyi/8402526 to your computer and use it in GitHub Desktop.
Save tytskyi/8402526 to your computer and use it in GitHub Desktop.
(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