Skip to content

Instantly share code, notes, and snippets.

@waxzce
Created January 15, 2012 21:09
Show Gist options
  • Save waxzce/1617346 to your computer and use it in GitHub Desktop.
Save waxzce/1617346 to your computer and use it in GitHub Desktop.
find dups id in your html
var find_dbl_ids = function(){
var names = {};
$('*[id]').each(function(i, e){
var iid = $(e).attr('id');
if(iid != null && iid != ''){
if(names[iid] == undefined){
names[iid] = 1;
}else{
names[iid] = names[iid]+1;
}
}
}.bind(this));
var logs = require('logger4js').named('finddblid');
for(var y in names){
var name_nb = names[y];
if(name_nb > 1){
logs.info(y + ' : '+name_nb);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment