I have a series of pages which may or may not have a particular element defined on them. All of these pages share a common footer file which attempts to reference this particular element. I am trying to test if the element exists before I reference it, but whenever I do an error is thrown at the check saying that the element is undefined. I would have thought that checking for undefined would have been sufficient, but apparently not. Is there a way to test for an element which may not exist without throwing an error?
This is the code I’m using:
[CODE]
if (typeof(CustomDialog) !== undefined) { //this is the line throwing the error
sCommand = “CustomDialog.hide(‘customDialog’)”;
setTimeout(sCommand,10);
}