Click to See Complete Forum and Search --> : how to determine if dom element exists...?


jschrock
05-14-2003, 07:02 AM
I've seen the command but can't for the life of me remember what it is... Basically looking for an expression that indicates the existance of whether a dom element exists. Its something like typdef or defined/undef or something.... It does not use null for example if (document.somthing == null) . It determenes whether an element exists and is not null. Can someone remember, thanks in advance...

Gollum
05-14-2003, 07:07 AM
sounds like 'undefined' is the word you are searching for

but you don't actually need to use that word most of the time, you can just say...

if ( document.someObject ) document.someObject.doSomething();

jschrock
05-15-2003, 06:42 AM
Yes, thanks you that's what I was looking for, although its good to know the alternatives as well....

typeof document.all == 'undefined'

Thanks for your help.....