> One of the great things about jQuery, however, is the basic concept.
> If it doesn't find the element it doesn't do anything so there is no
> need for conditional logic ;)
That's really great, thanks for making it clear for me...jQuery is
goodness, the more I know it, the more I love it :)
Boh
Hi Bohdan,
Is there some jQuery way of doing this, or should I use the old DOM
one?
You bet, try this (or something similar):
if( $('#myElem').length > 0 )doSomething();
else return false;
~Sean
You can use a selector such as $('#myElem') to get an element by ID. $
('#myElem').size() gives you the size of the matched set - you can use
that in an if statement if you want.
One of the great things about jQuery, however, is the basic concept.
If it doesn't find the element it doesn't do any
3 matches
Mail list logo