我不知道該如何定位我想在這種情況下,元素:靶向組分
var $div = $(".row-container").filter(function() {
return $(this).data("i") == product_id;
// where value == product id to find
});
現在,內$div
是具有類'price-row'
這就是一個元素我想要。 $div.hasClass('price-row')
只返回true或false值。
請你更新你的問題來顯示一些例子的HTML?我一個人不太明白你想要做什麼。你的最後一句話聽起來像'$ div'通過現有的'.filter()'方法正確設置,但現在你想要找到一個子元素?或者是如何讓'.filter()'做你需要的? 「碎片」概念到哪裏去了? – nnnnnn