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