Created
August 11, 2014 00:04
-
-
Save jackmcpickle/b53046014c9a3ac88f66 to your computer and use it in GitHub Desktop.
get class function vanilla js IE8 friendly
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
getClass = function(Cname) { | |
var elements = document.getElementsByTagName('*'), i,classElems = []; | |
for (i in elements) { | |
if ((" " + elements[i].className + " ").indexOf(" "+Cname+" ") > -1) { | |
classElems.push( elements[i] ); | |
} | |
} | |
return classElems; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment