Skip to content

Instantly share code, notes, and snippets.

@tkh44
Created March 29, 2012 21:28
Show Gist options
  • Save tkh44/2243991 to your computer and use it in GitHub Desktop.
Save tkh44/2243991 to your computer and use it in GitHub Desktop.
var subs = YAHOO.util.Dom.getElementsByClassName('sub', 'ul');
for(var i = 0; i < subs.length; i++){
var subListChildren = YAHOO.util.Dom.getChildren(subs[i]);
for(var k = 1; k < subListChildren.length + 1; k=k+2){
YAHOO.util.Dom.addClass(subListChildren[k], 'even');
}
}
@cpanel
Copy link

cpanel commented Mar 29, 2012

var li_els = YAHOO.util.Selector.query("ul.sub li:nth-child(2n)").forEach( function(li) { DOM.addClass(li,"even") } );

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment