jQuery visible selector
Description and Syntax
$(':visible')
selects all elements that are visible.
Examples
$('li:visible')
selects all<li>
elements that are visible$('.myclass:visible')
selects all elements with the classmyclass
that are visible
The following code selects visible div elements.
<html>
<head>
<script src="http://java2s.com/style/jquery-1.8.0.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){<!-- w w w .java 2 s .c om-->
$("div:visible").click(function () {
$(this).css("background", "yellow");
});
});
</script>
</head>
<body>
<body>
<span></span>
<div style="display:none;">java2s.com!</div>
<div>click me</div>
</body>
</html>