I have a UL that contain any number of LIs. I am trying to create some jQuery code that will parse the original UL and wrap a UL and another LI after every 5 of the original
jQuery('ul#original_ul').attr('id', 'processed_ul') .find('li:nth-child(5n)').each(function() { $(this).prevAll('li').andSelf() .wrapAll(''); });