Remove item[i] from jQuery each loop

后端 未结 7 1985
别跟我提以往
别跟我提以往 2020-12-15 03:05

How do I remove an item[i] from items once it reaches in:

$.each(items, function(i) {
    // how to remove this from items
});
7条回答
  •  一向
    一向 (楼主)
    2020-12-15 03:36

    Something like

    var indexToBeRemoved = 3; // just an illustration
    $.each(items, function(i) {
        if(i==indexToBeRemoved){
            $(this).remove();
        }
    });
    

提交回复
热议问题