Removed rows are still there making it difficult to target row I want.

Removed rows are still there making it difficult to target row I want.

I have rows that I am trying to remove, then auto-open a link on the row that is then in the first spot. The problem is its opening the link thats in the first row that I removed- like its still there.

Does remove actually remove? It seems like it is not actually removing.

// if row contains any keywords in array then remove row (array here) var o; var goodlen = good.length; for(o = 0; o < goodlen; o++){ var x = good[o]; $("span:contains('"+ x +"')").closest("div").remove(); //-------auto open link in current top row--------- var slug = $('.class')eq(0).attr('href'); if(slug){ window.location = "https://xzxz.com" + slug;}

After removing unwanted rows how do I target the link on the NOW top row?