我试过了Wrap
,WrapALl
也试过了,nextUntil
但这个很棘手。我有这个 html
<ul class="quick-list quick-glance hideOnSearch show-for-medium-up">
<li><span class="strong">Price:</span> $198000</li>
<li><span class="strong">Miles:</span> 349999</li>
<li><span class="strong">Vehicle Type:</span> Minivans and Vans</li>
</ul>
我希望它看起来像
<ul class="accordion show-for-small hide-for-medium-up">
<li>
<div class="title">TITLE</div>
<div class="content">
<ul class="quick-list quick-glance hideOnSearch show-for-medium-up">
<li><span class="strong">Price:</span> $198000</li>
<li><span class="strong">Miles:</span> 349999</li>
<li><span class="strong">Vehicle Type:</span> Minivans and Vans</li>
</ul>
</div>
</li>
</ul>
我试过这个
$('ul.quick-list').wrapAll('<ul class="accordion"><li><div class="title">TITLE</div><div class="content"></div></li></ul>'); //Single page Top accordion
但它放在quick-list
错误的地方。
我怎么能用 jQuery 做到这一点?