I would like to remove the following table from the page with Jquery by targeting the following text “To add the above items to your cart”.
I tried this but didn’t work as expected it removes a different parent td.
Not sure how to target this td only.
$("* :contains('To add the above items to your cart')").closest('td').remove();
<td colspan="11" class="colors_backgroundlight" align="right">
<span>To add the above items to your cart, click the "Add" checkboxes then click "Add To Cart" >>></span> <input type=submit value="Add To Cart" onclick="refineResults=false;" name="checkboxes_mode_submitbtn"
You can do it like this:
Any parent will also contain the text, since it’s in a child element. You need to be a bit more specific about what contains the text and move up from there…otherwise it’ll find all the parents as well.
Or, to be very accurate, but probably overkill: