Javascript find index of missing elements of two arrays

前端 未结 4 402
[愿得一人]
[愿得一人] 2021-01-28 18:34

I have the following JavaScript where I have some lists:

var deleteLinks = $(\".remove-button .remove-from-cart\");
deleteLinks.on(\'click\', function(ev){
            


        
4条回答
  •  夕颜
    夕颜 (楼主)
    2021-01-28 19:11

    As I can see from your code, you need to compare innerText of the two objects and find the indices of missing elemnts.

    var missing_indices = [];
    for(var i=0;i

    Then use missing_indices to remove missing elements from currentHTML

提交回复
热议问题