jQuery bookmarklet: find duplicate ID's on the page


/ Published in: JavaScript
Save to your folder(s)

<a href="javascript:(function(){var%20ids=[];jQuery('*').each(function(){if(this.id&&this.id!==''){if(ids[this.id]){console.log('duplicate%20id%20found:%20'+this.id,this,ids[this.id])}else{ids[this.id]=this}}});})();">Find duplicate IDs</a> (drag me to your tookbar).

Requires Firebug and jQuery on the page.


Copy this code and paste it in your HTML
  1. javascript:(function(){var%20ids=[];jQuery('*').each(function(){if(this.id&&this.id!==''){if(ids[this.id]){console.log('duplicate%20id%20found:%20'+this.id,this,ids[this.id])}else{ids[this.id]=this}}});})();

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.