Excellent, Dave. Your explanation is much appreciated.  I'd tried something
similar in my 'period of frustration', but didn't know about the []'s
denoting descendents.


dave.methvin wrote:
> 
>> 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/
> 
> 

-- 
View this message in context: 
http://www.nabble.com/How-to-not-select-something--tf2843376.html#a7944073
Sent from the JQuery mailing list archive at Nabble.com.


_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/

Reply via email to