I normally use the jQuery method MorningZ posted above, as it makes it
easier to check for the existence of elements with a certain class
name.

On Oct 27, 2:05 pm, Michel Belleville <michel.bellevi...@gmail.com>
wrote:
> As correct as 0 == false et 1..oo == true
>
> Michel Belleville
>
> 2009/10/27 bc04Inc. <bc04...@googlemail.com>
>
>
>
> > I have now found this one:
>
> > if ($('#toc').length) {
> > }
>
> > is this correct, too?
>
> > On 27 Okt., 14:39, MorningZ <morni...@gmail.com> wrote:
> > > if (document.getElementById("xyz")) {
> > >       // exists}
>
> > > else {
> > >       // does not exist
>
> > > }
>
> > > or, if you must use jQuery for whatever reason (which would ultimately
> > > use the above anyways)
>
> > > if ($("#xyz").length > 0) {
> > >       // exists}
>
> > > else {
> > >       // does not exist
>
> > > }
>
> > > On Oct 27, 9:37 am, "bc04Inc." <bc04...@googlemail.com> wrote:
>
> > > > Hi,
>
> > > > how can i check if a DIV with the ID xyz exist?
>
> > > > thank you
> > > > yavuz- Zitierten Text ausblenden -
>
> > > - Zitierten Text anzeigen -

Reply via email to