[ jquery 选择器 :visible ] 此方法选取匹配所有的可见元素

此方法选取匹配所有的可见元素:

实例:

<!DOCTYPE html>
<html class='html'>
<head class='head'>
<meta charset=' utf-8'>
<meta name='author' content='http://www.52jb.net/' />
<script type='text/javascript' src='./js/jquery-1.12.1.min.js'></script>
<title>Inset you title</title>
<style type='text/css'>
    *{margin:0;padding:0;}
    div,form{150px;height:20px;margin:20px;}
    #hidden,#user{display:none;}
    #opacity{filter:alpha(opacity=0);opacity:0;}
</style>
<script type='text/javascript'> 
    $(function(){ 
           alert($('body :visible').get(0).className);
    });
</script>
</head>
<body class='body'>
    <div id='hidden' class='hidden'>hidden element</div>
    <div id='opacity' class='opacity'>opacity element</div>
    <form id='form' class='form'>
        <input type='text' id='user' />
        <input type='hidden' class='hidden' value='hidden-form-input'/>
    </form>
</body>
</html>
原文地址:https://www.cnblogs.com/mysearchblog/p/5606537.html