I try to empty()
a div but exclude a specific selector.
What I've tried so far:
$('.modal').find('.close').nextAll().empty();
$('.modal').find(':not(.close)').empty();
$('.modal').not('.close').empty();
$('.modal:not(.close)').empty();
HTML:
<div class="modal">
<a href="#" class="close">Close</a>
...I've the need to be removed...
</div>
Could be done like this:
http://fiddle.jshell.net/KLh4E/11/
$(".modal").contents().filter(function(){
return !$(this).is('.close');
}).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