Created
March 6, 2015 17:51
-
-
Save thinsoldier/9f5d9822fade6806ad6e to your computer and use it in GitHub Desktop.
Detect duplicate id's in html document.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
jq = jQuery; | |
var collection = {}; | |
// change selector to * for everything use it to limit the kinds of nodes that get inspected. | |
jq('[name*=amenities]').each( | |
function(i,e){ | |
var found = jq('[id=' + e.id + ']'); | |
var count = found.length; | |
if( count > 1 ) { | |
collection[e.id] = {'count':count,'elements':jq.makeArray(found)}; | |
} | |
} | |
); | |
console.table(collection); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment