Wrap every 5 items in jQuery for each -
hi trying grouped elements inside foreach loop. couldn't figured yet.
$select.children('option.active,option.enabled').each(function(i, option) { var $option = jquery(option), selectid = $option.parent('select').attr('id'); $variationitems.find('input[type="radio"]') .filter('[name="'+selectid+'"]') .filter('[value="'+option.value+'"]') .parents('.mspc-variation:first').show() $variationitems.find('input[type="checkbox"]') .filter('[name="'+selectid+'"]') .filter('[value="'+option.value+'"]') .parents('.mspc-variation:first').show() if( <= 5 ){ $variationitems.wrapall('<div class="grouped-section-1"/>'); }else if ( <= 10) { $variationitems.wrapall('<div class="grouped-section-2"/>'); } else if ( <= 15 ) { $variationitems.wrapall('<div class="grouped-section-3"/>'); } });
$select.children('option.active,option.enabled') gives array of elements , wanna wrap each 5 items
<div class="section-row"></div>
really appreciate if can me this. in advanced
Comments
Post a Comment