How to remove item from jquery array object.
I used splice method as follows. But it slice next item of array[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);
}
})
Can anyone tell me where i am wrong here?