class method Element.visible

View source on GitHub →

Element.visible(element) → Boolean

Tells whether element is visible (i.e., whether its inline display CSS property is set to none.

Examples
<div id="visible"></div>
<div id="hidden" style="display: none;"></div>

And the associated JavaScript:

$('visible').visible();
// -> true
 $('hidden').visible();
// -> false
Notes

Styles applied via a CSS stylesheet are not taken into consideration. Note that this is not a Prototype limitation, it is a CSS limitation.

<style>
  #hidden-by-css {
    display: none;
  }
</style>
 [...]
 <div id="hidden-by-css"></div>

And the associated JavaScript:

$('hidden-by-css').visible();
// -> true

This method can be called either as an instance method or as a generic method. If calling as a generic, pass the instance in as the first argument.