Hey all,
I am trying to do some error checking in my javascript code and I have ran across an issue with the visibility of an object.
I am hiding an object on the page using document.getElementById('objectname').style.display = 'none';
When I go to see if it exists using the code below (the object IS not visible on the screen at the time), nothing happens
if(document.getElementById('objectname').style.visibility == 'hidden')
{
alert('message');
}
I have also used with no avail:
if(document.getElementById('objectname').style.display == 'none')
{
alert('message');
}
Any ideas?
Tuesday, January 29, 2008
Subscribe to:
Post Comments (Atom)
1 comment:
This worked for me:
if(document.getElementById('objectname').style.display == 'none')
{
alert('message');
}
document.getElementById('objectname').style.visibility will be undefined since you didn't set its visibility but its display.
Post a Comment