0

So now... I am trying to remove the div class 'box' based on the product having the title 'iPhone' in the string in this picture

2mandude
  • 9
  • 3

1 Answers1

0

Take a look at :contains selector, you can use the following code.

$("p:contains('iPhone')").closest("div.box").remove();

p:contains('iPhone') will get all <p> which contains iPhone in it text, while closest("div.box") will get the first div with class box, then remove will remove the div as well as everything inside it.

Haibara Ai
  • 10,703
  • 2
  • 31
  • 47