I am trying to do this but no luck so far does anyone know how to select an element on click
but not include elements in specific div like .box
and all content inside that div .box
small update:
thank you for responses, but if i am using :not
or hasClass
it won't assure that elements inside that foo
won't be selected. like:
<div class=foo>this won't be selected <span>this will</span></div>
You could use the hasClass()
method:
$('a').click(function() {
if (!(this).hasClass('foo')) {
// the clicked element doesn't have the foo class
}
return false;
});
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