Skip to content

Instantly share code, notes, and snippets.

@SFantasy
Last active December 17, 2015 00:29
Show Gist options
  • Save SFantasy/5520962 to your computer and use it in GitHub Desktop.
Save SFantasy/5520962 to your computer and use it in GitHub Desktop.
My implementation of `getElementsByClass()`
function getClass(c) {
var l = document.getElementsByTagName('*');
var x = new Array();
for(var i = 0; i < l.length; i++) {
if(l[i].classList !== undefined && l[i].classList.contains(c)) {
x.push(l[i]);
}
}
return x;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment