Hi all,

I have a two level list :
<ul>
  <li>
  <a href="" class="to be copied"></a>
  <ul>
    <li></li>
    ...
  </ul>
 </li>

  <li>
  <a href=""  class="to be copied"></a>
  <ul>
    <li></li>
    ...
  </ul>
 </li>

I want to take all the first level a and copy them as the first
element in the list:
<ul>
  <li>
  <a href="A" class="to be copied"></a>
  <ul>
    <li><a href="A" class="copied"></a></li>
    <li></li>
    ...
  </ul>
 </li>

  <li>
  <a href="B"  class="to be copied"></a>
  <ul>
    <li><a href="B" class="copied"></a></li>
    <li></li>
    ...
  </ul>
 </li>


I know how to select each a item:

jQuery("ul ul").siblings("a")

I would know how to wrap the li around them and clone them, but once
done, I don't know how to put each of them below their list.

I've tried using .prependTo, but it copies (rightly) all the links
below every item.

Do you have any suggestion ? I'm stuck and I fell like I'm missing
something obvious.

Any idea or link to the doc I missed more than welcome!

Xavier

Reply via email to