[jQuery] Re: newbie: test for null selection

2009-10-22 Thread Richard D. Worth
That pretty much sums up the beauty of jQuery. :) - Richard On Thu, Oct 22, 2009 at 1:51 AM, BradW wrote: > > Aha! So if I understand the implications of this, a selector always > returns a wrapper object that acts like BOTH a javascript array and > like a single DOM element – even though it i

[jQuery] Re: newbie: test for null selection

2009-10-21 Thread BradW
Aha! So if I understand the implications of this, a selector always returns a wrapper object that acts like BOTH a javascript array and like a single DOM element – even though it is really neither. And this allows us to write elegant code that treats selectors as single objects, or as arrays, wh

[jQuery] Re: newbie: test for null selection

2009-10-21 Thread Dave Methvin
> How can I test that a control selection failed to find anything? if ( $("#missing").length == 0 ) { // it's not there } However, remember that if you apply jQuery methods to an empty selection it does nothing: $("#missing").hide(); // no-op