Well, just to split hairs, the length property returns a number, not a
true boolean. You could also use:

  $('*').is('#myId')   or you can reverse it like so: $
('#myId').is('*')

The .is() method does return a boolean. An advantage is that you can
apply this to a subset of elements, for example:

  $('a').is('#myId')

Larry


On Dec 24, 7:55 am, Cloudream <[EMAIL PROTECTED]> wrote:
> $('#id').length>0 ?
>
> On Dec 24, 10:11 pm, debussy007 <[EMAIL PROTECTED]> wrote:
>
>
>
> > Hi,
>
> > what is the best way in jquery to check wether an id exists ?
>
> > Thank you for any kind help !!
> > --
> > View this message in 
> > context:http://www.nabble.com/check-if-an-id-exists-tp14488007s27240p14488007...
> > Sent from the jQuery General Discussion mailing list archive at 
> > Nabble.com.- Hide quoted text -
>
> - Show quoted text -

Reply via email to