Created
June 3, 2011 18:50
-
-
Save cduruk/1006925 to your computer and use it in GitHub Desktop.
ie classer
This file contains 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
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