Learn Prototype
Prototype Resources
Selected Reading
© 2011 TutorialsPoint.COM
|
Prototype visible() Method
This method returns a Boolean indicating whether or not element is visible ie. 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:
Return Value:
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>
|
To understand it in better way you can Try it yourself.
|
|
|