[jQuery] Re: How to check if a DIV with ID xyz exist?

2009-10-27 Thread amuhlou
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 wrote: > As correct as 0 == false et 1..oo == true > > Michel Belleville > > 2009/10/27 bc04Inc. > > > > > I have

[jQuery] Re: How to check if a DIV with ID xyz exist?

2009-10-27 Thread Michel Belleville
As correct as 0 == false et 1..oo == true Michel Belleville 2009/10/27 bc04Inc. > > I have now found this one: > > if ($('#toc').length) { > } > > is this correct, too? > > On 27 Okt., 14:39, MorningZ wrote: > > if (document.getElementById("xyz")) { > > // exists} > > > > else { > >

[jQuery] Re: How to check if a DIV with ID xyz exist?

2009-10-27 Thread bc04Inc.
I have now found this one: if ($('#toc').length) { } is this correct, too? On 27 Okt., 14:39, MorningZ wrote: > if (document.getElementById("xyz")) { >       // exists} > > else { >       // does not exist > > } > > or, if you must use jQuery for whatever reason (which would ultimately > use t

[jQuery] Re: How to check if a DIV with ID xyz exist?

2009-10-27 Thread MorningZ
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." w