How to make from a long list (li) lists (ul) of 10 elements li.
For example, there is one list with 30 elements:

<div class="list"> <ul> <li></li> ... <li></li> </ul> </div> 

At the exit you need to get 3 lists of 10 items instead of one big one:

 <div class="list"> <ul> <li></li> ... <li></li> </ul> <ul> <li></li> ... <li></li> </ul> <ul> <li></li> ... <li></li> </ul> </div> 

I found the function that does it:

 $('.list').each(function() { var group; while((group = $(this).find('li:lt(10)').remove()).length) { $(this).append($('<ul/>').append(group)); } }); 

Yes, of course, there will be several list classes, so for each you need to do processing, and then the problem is that we get into recursion.
If you write:

 $('body').append($('<ul/>').append(group)); 

then everything is fine, but you need to "redo" the original list, and not insert it into the body. Tell me how to do this?

    1 answer 1

    Maybe you will try http://neolot.com/narabotki/autocolumnlist-jquery-plugin-dlya-razdeleniya-spiskov-na-kolonki

    • Thank you for what you need. True, I wanted to get a modification of the function above. - lexpex