> What I'm trying to achieve is the element with id="save-search" only
> gets hidden if it does not contain a div with the class="error-message"
How about this?
$("#save-search:not([div.error-message])").hide();
It actually reads very much like the sentence above, once you know what all
the syntax means:
#save-search // select an element with id=save-search
:not( // as long as the following is not found:
[ // descendent elements containing
div // a div
.error-message // with class error-message
])
Notice that it's _very_ important to put the :not right after the id name.
If there was a space after the id it would select _descendants_ of
#save-search that do not contain div.error-message.
_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/