我有这个数组,
var metrics = [
{
value: "1",
label: "Sold Listings",
desc: "sold_listings"
},
{
value: "10",
label: "New Pendings",
desc: "new_pendings"
},
{
value: "4",
label: "All Pendings",
desc: "all_pendings"
},
{
value: "2",
label: "New Listings",
desc: "new_listings"
},
{
value: "3",
label: "Active Listings",
desc: "active_listings"
}
];
我想要做的是 Selected 项目,例如我将选择 Active Listings,这个项目应该从数组中删除。这样当自动完成再次呈现时,它不会显示所选项目。
//My Idea of removing the item
$.each(metrics,function(i,val){
if(val.value == ui.item.value){
delete metrics[i];
}
});