- Prototype Tutorial
- Prototype - Home
- Prototype - Short Overview
- Prototype - Useful Features
- Prototype - Utility Methods
- Prototype - Element Object
- Prototype - Number Processing
- Prototype - Strings Processing
- Prototype - Array Processing
- Prototype - Hash processing
- Prototype - Basic Object
- Prototype - Templating
- Prototype - Enumerating
- Prototype - Event Handling
- Prototype - Form Management
- Prototype - JSON Support
- Prototype - AJAX Support
- Prototype - Expressing Ranges
- Prototype - Periodical Execution
- Prototype Useful Resources
- Prototype - Quick Guide
- Prototype - Useful Resources
- Prototype - Discussion
Prototype - visible() Method
This method returns a Boolean indicating whether or not the element is visible i.e., whether its inline style property is set to "display: none;".
NOTE − Styles applied via a CSS stylesheet are not taken into consideration. Note that this is not a Prototype limitation, it is a CSS limitation.
Syntax
element.visible();
Return Value
An HTML element.
Example
<html> <head> <title>Prototype examples</title> <script type = "text/javascript" src = "/javascript/prototype.js"></script> <script> function showResult() { if( $('visible').visible() ) { alert("$('visible').visible() returns true" ); } else { alert("$('visible').visible() returns false" ); } if( $('hidden').visible() ) { alert("$('hidden').visible() returns true" ); } else { alert("$('hidden').visible() returns false" ); } } </script> </head> <body> <p>Click button to see the result</p> <div id = "visible" style = "display:block;"> This is visible division </div> <div id = "hidden" style = "display: none;"> This is hidden division </div> <input type = "button" value = "Click" onclick = "showResult();"/> </body> </html>
Output
prototype_element_object.htm
Advertisements