Prototype This page is part of the Prototype JavaScript framework documentation.
Overview | (...)

Element.visible returns false if display is set to none, true otherwise.

Note: an element with visibility set to hidden will return true !

Availability

V1.5_rc5 (prototype V 1.4.0_rc3)

Syntax


  Element.visible( element );

element can be any DOM Element object or an ID.

Example

with display:none


<p id="desc" style="display:none">
  An adept sycophant hides in his hole.
</p>

<p>
  <a href="#" onclick="alert(Element.visible('desc')); return false;">
     is this element visible?
  </a>
</p>

creates:

is this element visible?

with visibility:hidden


<p id="mypara" style="visibility:hidden">
  An adept sycophant hides in his hole.
</p>
<p>
  <a href="#" onclick="alert(Element.visible('mypara')); return false;">
    is this element visible?
  </a>
</p>

creates:

is this element visible?