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 anything so there is no
need for conditional logic ;)

On May 29, 12:22 pm, besh <[EMAIL PROTECTED]> wrote:
> Hi all,
> before jQuery, I was used to check for existence of certain elements
> like this:
>
> if (!document.getElementById('myElem')) {
>   return false;
>
> } else {
>   doSomething();
> }
>
> Is there some jQuery way of doing this, or should I use the old DOM
> one?
>
> Thanks!
>
> Bohdan

Reply via email to