Thanks Mike. Have to admit to a fatal flaw in my logic (that a nothing select
would return nothing), but I'm still *extremely* impressed with JQuery (just
not with myself)


malsup wrote:
> 
>> $(document).ready(function() {
>>   if (!$("#save-search div.error-message")) $("#save-search").hide();
>> });
>>
>> Would it be possible to let me know not just how to get this to work, but
>> also where I'm going wrong?
> 
> 
> Your test will never fail because $(..) always returns an object which
> does not resolve to false (even if it contains zero dom nodes).  You
> could rework it like this:
> 
> if (!$("#save-search div.error-message")[0]) {
>     // do stuff
> }
> 
> This expression will test the first element in the jQuery object, and
> that will resolve to false if nothing was selected.
> 
> Mike
> 
> _______________________________________________
> 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#a7940000
Sent from the JQuery mailing list archive at Nabble.com.


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

Reply via email to