我想要得到的項目列表中的一個頁面,並將其推到一個數組:jQuery的陣列中的多個項目
$('#softwareUpdates article').each(function(index) {
productList.push({
class: $(this).attr("class"),
text: $(this).attr("su_title")
});
});
不過,我想避免多個項目,所以當我目前的檢查productList的陣列我有:
Item 1, Item1, Item 2, Item 3, Item 3, Item 4
我想什麼有是:
Item 1, Item 2, Item 3, Item 4
試試這個:http://stackoverflow.com/questions/2822962/jquery-remove-duplicate-elements – 2012-08-01 15:08:41
你可以嘗試先使用'.filter()'。 – NicoSantangelo 2012-08-01 15:09:27