How can I select all elements that have a title
attribute, but are not contained by a element with the #boo
ID ?
like $("*[title]").each()...
but not elements which are in #boo
:)
$("[title]").not("#boo [title]").each()
and as a side note, when you use id
in getting the element, it is faster if you don't prefix the element's tag. For example, just use #boo
instead of div#boo
. demo <-- try to look at the console of firebug for time comparison.
$('*:not(#boo) *[title]');
should work.
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