wrap 6 li elements togheter on a long list

Posted by blackhandr on Stack Overflow See other posts from Stack Overflow or by blackhandr
Published on 2010-03-22T09:32:16Z Indexed on 2010/03/22 9:41 UTC
Read the original article Hit count: 434

Filed under:

I have a long list like this

<ul>
    <li>item 1</li>
    <li>item 2</li>
    <li>item 3</li>
    <li>item 4</li>
    <li>item 5</li>
    <li>item 6</li>
    <li>item 7</li>
    <li>item 8</li>
    <li>item 9</li>
    <li>item 10</li>
    <li>item 11</li>
    ...
</ul>

and i want somehow to wrap some div around like this:

<ul>
    <div>
        <li>item 1</li>
        ...
        <li>item 6</li>
    </div>

    <div>
        <li>item 7</li>
        ...
        <li>item 12</li>
    </div>

    <div>
        ...
    </div>
</ul>

how can accomplish this? :-\

i tryed .after('</div><div>'); but is not working, it adds like this <div></div>

© Stack Overflow or respective owner

Related posts about jQuery