Skip to content

Instantly share code, notes, and snippets.

@cduruk
Created June 3, 2011 18:50
Show Gist options
  • Save cduruk/1006925 to your computer and use it in GitHub Desktop.
Save cduruk/1006925 to your computer and use it in GitHub Desktop.
ie classer
var getClassedElemets = function(className, getFirst) {
if (typeof getFirst === undefined) getFirst = false;
var els = [];
var all = document.getElementsByTagName('*');
var arrEls = getArrFromNodeList(all);
for (var j=0; j < arrEls.length; ++j) {
var test = arrEls[j];
if (hasClass(test, className)) {
if (getFirst) {
return test;
}
els.push(test);
}
}
return els;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment