I understand that the way to see if there are any elements on the page
with the class of "foo" is this: $('.foo')
On a page with such elements, I will get a result like: jQuery(p.foo,
p.foo) and if there are no matching elements, I will get jQuery() --
or at least that's how it's displayed in Fire
On Thu, Dec 17, 2009 at 7:32 AM, Joe Grossberg
wrote:
> Instead, I do it like this (since zero is false-y in JavaScript):
>
> if ( $('.foo').length ) {
> alert('at least one matching element');
> } else {
> alert('nothing matches');
> }
>
> But is that the preferred way of doing this?
>
As far
2 matches
Mail list logo