Skip to content

Instantly share code, notes, and snippets.

@nhducit
Last active August 29, 2015 14:14
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 nhducit/60449650f1a3ae3b8973 to your computer and use it in GitHub Desktop.
Save nhducit/60449650f1a3ae3b8973 to your computer and use it in GitHub Desktop.
Javascript snippet to check duplicated ID in html page
Select all below snippet => drag and drop in browser bookmark bar
=> click on bookmark which you have just add => check the browser console
javascript:(function(){var e={};$("[id]").each(function(){var t=$('[id="'+this.id+'"]');if(t.length>1&&t[0]===this){e.id=this.id;e.obj=this;e.obj2=t[0]}});console.warn("Duplicate ID:",e.id,e.obj,e.obj2)})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment