Node.js examples for CSS:Class
Utility function for finding the first element parent with a classname class
/**//ww w . j a v a2 s . com * Utility function for finding the first ele element parent with a classname class * @param ele * @param classname * @return - the parent element or null */ function findParentByClassName(ele, classname) { var par = ele.parentElement; while (par != null) { if (hasClass(par,classname)) { break; } par = par.parentElement; } return par; }