DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world
Get Elements By Class Name
Return elements by class name given a parent node.
//+ Jonas Raoni Soares Silva
//@ http://jsfromhell.com
function getElementsByClassName(name, parent){
for(var o = [], n = new RegExp("\\b" + name.replace(/([(){}|*+?.,^$\[\]\\])/g, "\\\$1") + "\\b"), l = (parent || document).getElementsByTagName("*"), i = l.length; i--;)
n.test(l[i].className) && (o[o.length] = l[i]);
return o;
}





