如何从 jquery 数组对象中删除项目。
我使用拼接方法如下。但它切片数组[i] 的下一项。
$.each(array, function (i, item) {
var user = array[i];
jQuery.each(array2, function (index, idata) {
debugger
if (idata.Id == user.UserId) {
tempFlag = 1;
return false; // this stops the each
}
else {
tempFlag = 0;
}
});
if (tempFlag != 1) {
//removes an item here
array.splice(user, 1);
}
})
谁能告诉我这里哪里错了?