Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Remove div containing specific text and elements

Tags:

jquery

<div class="block">
    text
</div>
<div class="block">
    text
</div>
<div class="block">
    text <button />
</div>

Using jQuery, how can I remove the div containing both text and a button. I don't want to use :last

like image 326
O P Avatar asked Dec 01 '25 14:12

O P


1 Answers

$("div:contains('text')").remove()
like image 64
Hary Avatar answered Dec 03 '25 07:12

Hary



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!