Check if the nodeName
property exists.
Basically check if it is a Node
: look at the DOM lvl 1 specs, check the Node definition.
If you meant it literally when you said Element
check for tagName
property, look at the Element definition in the same spec
So to recap, do either
function Check(o)
{
alert(o.tagName ? "true" : "false");
}
to check if it is a DOM Element or
function Check(o)
{
alert(o.nodeName ? "true" : "false" );
}
to check if it is a DOM Node