假设这是我的 HTML
<ul class="products>
<li class="product">
<div class="product-title></div>
<div class="product-thumbnail></div>
<div class="product-price></div>
<div class="product-discription></div>
</li>
<li class="product">
<div class="product-title></div>
<div class="product-thumbnail></div>
<div class="product-price></div>
<div class="product-discription></div>
</li>
</ul>
现在我想换.product-thumbnail
行.product-price
<div class="left"></div>
像这样
<ul class="products>
<li class="product">
<div class="product-title></div>
<div class="left">
<div class="product-thumbnail></div>
<div class="product-price></div>
</div>
<div class="product-discription></div>
</li>
<li class="product">
<div class="product-title></div>
<div class="left">
<div class="product-thumbnail></div>
<div class="product-price></div>
</div>
<div class="product-discription></div>
</li>
</ul>
如果我只有一个列表项,则此代码可以解决问题
$(".product-thumbnail, .product-price").wrapAll("<div class='left'></div>");
我试过了each()
,.product-thubnail
但.product-price
没有结果..
有谁知道我该怎么做或怎么做each()
?