[jQuery] Grouping elements using wrap?

[jQuery] Grouping elements using wrap?

I have a list of elements similar to the following:
<div id="notes">
<div class="note">note</div>
<div class="note">note</div>
<div class="note">note</div>
<div class="note">note</div>
<div class="note">note</div>
<div class="note">note</div>
<div class="note">note</div>
<div class="note">note</div>
</div>
Is there a way I can group these elements by threes, wrapping them in
another div? Eg:
<div id="notes">
<div id="page_1">
<div class="note">note</div>
<div class="note">note</div>
<div class="note">note</div>
</div>
<div id="page_2">
<div class="note">note</div>
<div class="note">note</div>
<div class="note">note</div>
</div>
<div id="page_3>
<div class="note">note</div>
<div class="note">note</div>
</div>
</div>
I've tried:
i = 0;
while $('#notes>.note').size() > 0
{
++i;
$('#notes>.note:lt(4)').wrap('<div id="page_'+i+'"></div>');
}
but I've not had any success.
_______________________________________________
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/