我想要得到的项目列表中的一个页面,并将其推到一个数组: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