Skip to content

Instantly share code, notes, and snippets.

@jaredwy
Created November 23, 2012 00:26
Show Gist options
  • Save jaredwy/4133447 to your computer and use it in GitHub Desktop.
Save jaredwy/4133447 to your computer and use it in GitHub Desktop.
var elements = Array.prototype.slice.call(document.querySelectorAll('*')),
counts = {};
elements.forEach(function(i) {
if(!counts[i.tagName]) { counts[i.tagName] = 1 }
else { counts[i.tagName]++ }
i.id = i.tagName + counts[i.tagName]
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment