Skip to content

Instantly share code, notes, and snippets.

@ilhantekir
Created November 22, 2018 11:14
Show Gist options
  • Save ilhantekir/7145c9cc7b4f2bc44ae10b466f905e07 to your computer and use it in GitHub Desktop.
Save ilhantekir/7145c9cc7b4f2bc44ae10b466f905e07 to your computer and use it in GitHub Desktop.
JQuery to check for duplicate ids in a DOM
$('[id]').each(function(){
var ids = $('[id="'+this.id+'"]');
if(ids.length>1 && ids[0]==this)
console.warn('Multiple IDs #'+this.id);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment