我有以下标记:
<ul>
<li>
<a href="#"><img src="sample-big-product.png" alt="" title="" /></a>
<span><a href="#">View Product</a></span>
<ul><li>1,2,3</li></ul>
<h2>Featured product name</h2>
<p>Lorem ipsum dolor sit amet, cosetur adispci elit. Morbi poseure ante porta justo...</p>
</li>
<li>
<a href="#"><img src="sample-big-product.png" alt="" title="" /></a>
<span><a href="#">View Product</a></span>
<ul><li>1,2,3</li></ul>
<h2>Featured product name</h2>
<p>Lorem ipsum dolor sit amet, cosetur adispci elit. Morbi poseure ante porta justo...</p>
</li>
<li>
<a href="#"><img src="sample-big-product.png" alt="" title="" /></a>
<span><a href="#">View Product</a></span>
<h2>Featured product name</h2>
<p>Lorem ipsum dolor sit amet, cosetur adispci elit. Morbi poseure ante porta justo...</p>
</li>
<li>
<a href="#"><img src="sample-big-product.png" alt="" title="" /></a>
<span><a href="#">View Product</a></span>
<h2>Featured product name</h2>
<p>Lorem ipsum dolor sit amet, cosetur adispci elit. Morbi poseure ante porta justo...</p>
</li>
</ul>
这是我的 jquery,所以在这里我针对所有 LI 和所有 UL。但我只想针对 ul li 而不是 ul li ul li
// get all available UL and LI elements...
var li_elements = container.find("LI").clone();
// remove the current content so that we can rebuild it for the slider...
container.find("UL").remove();
ps 显然我可以简单地将 .class 添加到它们。但我不想让标记复杂化......