Revision: 62591
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at March 1, 2013 06:53 by adambundy
Initial Code
var myEls = $('.main > li'); var numEls = myEls.length; for ( i=0; i<numEls; i=i+3 ) { myEls.eq(i) .add( myEls.eq(i+1) ) .add( myEls.eq(i+2) ) .wrapAll('<div class="wrapper"/>'); }
Initial URL
Initial Description
myEls should be the selector statement for whatever elements you want to effect. The example wraps every 3.
Initial Title
jQuery wrap every X elements in a set with a div
Initial Tags
javascript, jquery
Initial Language
jQuery