I have the following markup which is just a small portion of the total markup.
<div align="center">
<img src="v/vspfiles/templates/100/images/headings/heading_shoppingcart.gif">
</div>
<br><br>
I would like to remove the two <br>
tags.
Note: there are other <br>
tags on the page both before this and after this that I do not want to removed.
I thought of using a selector to target the div by the src which contains heading_shoppingcart.gif
and something like .after
and then .remove
the <br>
.
Unsure of the correct syntax or if there is a better/easier way to do it.
This will safely retain any subsequent <br>
elements since you seemed to allude to the idea that there may be more that should be preserved.
$('img[src$=heading_shoppingcart.gif]').parent().nextUntil(':not(br)').remove();
How about:
$("img[src$='heading_shoppingcart.gif']").parent().nextAll('br').remove()
[$=]
is the 'attribute ends with' selector..parent()
moves up to the containing element.nextAll()
gets all following siblings$('[src~=images/headings/heading_shoppingcart.gif]').parent().nextAll('br').remove();
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With