Skip to content

Instantly share code, notes, and snippets.

@bertrandg
Created June 18, 2014 15:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bertrandg/593d072906de6536c076 to your computer and use it in GitHub Desktop.
Save bertrandg/593d072906de6536c076 to your computer and use it in GitHub Desktop.
(function(){
var all_ids = [];
var duplicate_ids = [];
$('[id]').each(function(index){ all_ids.push( $(this).attr('id') ) })
all_ids = all_ids.sort();
for (var i = 0; i < all_ids.length - 1; i++) {
if (all_ids[i + 1] == all_ids[i]) duplicate_ids.push(all_ids[i]);
}
console.log('duplicate id: ', duplicate_ids);
})()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment