Thank you Karl - much appreciated the explanation. I (wrongly) assumed a
select of nothing would return false or null, not an empty quacking array...
Karl Rudd wrote:
>
> jQuery objects are collections of objects and "quack"* (act) like
> Array objects. So you could do this:
>
> $(document).ready(function() {
> if ( $("#save-search div.error-message").length == 0 )
> $("#save-search").hide();
> });
>
> Karl Rudd
>
> * A slightly obscure reference to Duck Typing -
> http://en.wikipedia.org/wiki/Duck_typing
>
> On 12/19/06, GreyCells <[EMAIL PROTECTED]> wrote:
>>
>> Hi
>>
>> I thought I was getting the hang of JQuery until I tried to optionally
>> not
>> select an element....
>>
>> 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"
>>
>> This is what I thought it should be, but it doesn't have the desired
>> effect:
>>
>> $(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?
>>
>> In search of education, with many thanks
>>
>> ~GreyCells
>> --
>> View this message in context:
>> http://www.nabble.com/How-to-not-select-something--tf2843376.html#a7939646
>> Sent from the JQuery mailing list archive at Nabble.com.
>>
>>
>> _______________________________________________
>> jQuery mailing list
>> [email protected]
>> http://jquery.com/discuss/
>>
>
> _______________________________________________
> 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#a7939938
Sent from the JQuery mailing list archive at Nabble.com.
_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/