You're welcome. Note that something simpler that looks like it should work:
$(this).next().prepend($(this).clone().wrap("<li></li>"));
actually won't work because .wrap() needs to get the parent element, and
a .clone()'d element doesn't have one. I've been tripped up for hours
before on that combination!
Cheers,
-- Scott
xavier wrote:
Thanks Scott and Karl !
Now I got it, I was missing the $(this) trick to get a jquery object
from a dom one. I've added it to the wiki (on each and on get
sections).
Xavier
On Apr 12, 4:28 pm, Scott Sauyet <[EMAIL PROTECTED]> wrote:
xavier wrote:
I have a two level list :
[ ... ]
I want to take all the first level a and copy them as the first
element in the list:
There might be something simpler, but I think this would work:
$("ul ul").siblings("a").each(function(i) {
$(this).next().prepend($(this).clone()).children().eq(0).wrap("<li></li>");
});
Good luck,
-- Scott