jQuery 可见性过滤选择器
直接输入$(':visible')和$(':hidden')会有些好玩的东西;<div></div>是visible的,<span></span>是hidden的;<div />是visible的;
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%> <% String path = request.getContextPath(); String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path + "/"; %> <!DOCTYPE html> <html> <head> <base href="<%=basePath%>"> <meta charset="UTF-8"> <title>b index</title> <link rel='stylesheet' type="text/css" href='b/css/bootstrap.css'> </head> <body style="margin:150px;"> <h1>this is h1</h1> <div id="p1"> <h2>this is h2</h2> <input type="text" > <div id="c1">1</div> <div id="c2">2 <div id="cc21">21</div> <div id="cc22">22</div> <div id="cc23">23</div> </div> <div id="c3">3</div> <div id="c4">d4</div> <div id="c5">d5</div> <div id="c6"> </div><!-- 有一个空格:empty就找不到了 --> <div id="c7"></div> <div id="c71"><!-- 这种情况:empty也找不到 --></div> <div id="c8"><span></span><span>2</span></div> <div id="c9" style="display:none"></div> </div> <script type="text/javascript" src="js/jquery-1.11.1.js"></script> <script type="text/javascript" src="b/js/bootstrap.js"></script> <script type="text/javascript" src="js/index021.js"></script> </body> </html>