描述:选择所有可见的元素。
例:点击时让所有的可见的div元素变黄。
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>visible demo</title>
<style>
div{
50px;
height:40px;
margin:5px;
border:3px outset green;
float:left;
}
.starthidden{
display:none;
}
</style>
<script src="./js/jquery-1.9.1.min.js"></script>
</head>
<body>
<button>Show hidden to se they don't change</button>
<div></div>
<div class="starthidden"></div>
<div></div>
<div></div>
<div style="display:none;"></div>
<script>
$("div:visible").click(function(){
$(this).css("background","yellow");
});
$("button").click(function(){
$("div:hidden").show("fast");
});
</script>
</body>
</html>