假设我有一个这样编码的列表:
<ul id="Folder" name="Folder">
<li value="0">Top Folder</li>
<li value="11">2nd Folder 01</li>
<li value="17" class="third">---3rd Folder 01-01</li>
<li value="18" class="third">---3rd Folder 01-02</li>
<li value="383" class="fouth">------4th Folder 01-02-01</li>
<li value="384" class="fifth">---------5th Folder 01-02-01-01</li>
<li value="385" class="fifth">---------5th Folder 01-02-01-02</li>
<li value="386" class="fifth">---------5th Folder 01-02-01-03</li>
<li value="387" class="fifth">---------5th Folder 01-02-01-04</li>
<li value="388" class="fifth">---------5th Folder 01-02-01-05</li>
<li value="19" class="third">---3rd Folder 03</li>
<li value="20" class="third">---3rd Folder 04</li>
<li value="22" class="third">---3rd Folder 05</li>
<li value="130" class="fouth">------5th Folder 01-02-05-01</li>
<li value="131" class="fouth">------5th Folder 01-02-05-02</li>
<li value="132" class="fouth">------5th Folder 01-02-05-03</li>
<li value="133" class="fouth">------5th Folder 01-02-05-04</li>
<li value="134" class="fouth">------5th Folder 01-02-05-05</li>
<li value="398" class="fouth">------5th Folder 01-02-05-06</li>
<li value="158">2nd Folder 02</li>
<li value="257" class="third">---3rd Folder 02-01</li>
<li value="258" class="third">---3rd Folder 02-02</li>
<li value="259" class="third">---3rd Folder 02-03</li>
<li value="16">2nd Folder 03</li>
<li value="382" class="third">---3rd Folder 03-01</li>
<li value="51" class="third">---3rd Folder 03-02</li>
<li value="113" class="fouth">------4th Folder 03-02-01</li>
<li value="125" class="fouth">------4th Folder 03-02-02</li>
</ul>
我使用了jquery:
$('li.fifth').wrapAll('<ul>');
$('li.fouth').wrapAll('<ul>');
$('li.third').wrapAll('<ul>');
所以我可以将所有的第 5、4 和 3 li 组合成一个组。
我现在遇到的问题是,如何将第 5 个 ul 组移动到第 4 个 li 父级?和第 4 ul 组到第 3 li 等...