JQuery判断div(控件)是否为隐藏

1 以下是JavaScript 中判断div是否为隐藏代码引用片段:
2 
3 if (div.style.display == "none") {
4     div.style.display = "block";
5 }
6 else {
7     div.style.display = "none";
8 }
 1 以下是JQuery 中判断div是否为隐藏代码引用片段:
 2 
 3 <html xmlns="http://www.w3.org/1999/xhtml">
 4 <head>
 5 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
 6 <title>jquery判断div是否为隐藏</title>
 7 <script src="jquery-1.3.2.js"></script>
 8 <script>
 9 $(document).ready(function(){
10     var temp= $("#test").is(":hidden"); //是否隐藏
11     var temp1= $("#test").is(":visible"); //是否可见
12     alert(temp);
13     alert(temp1);
14     
15     //$(".sFeature").click(function() {
16     //    var FeatureId = $(this).attr("id");
17     //    if($("#bp" + FeatureId).is(":hidden")) {
18     //        $("#bp" + FeatureId).show();
19     //    }
20     //    else {
21     //        $("#bp" + FeatureId).hide();
22     //    }
23     //});
24 });
25 </script>
26 </head>
27 <body>
28 <p οnclick='test()'>隐藏测试</p>
29 <div id="test" style="display:none"></div>
30 </body>
31 </html>

转载自:http://www.lezhu99.com/1741.html

转载于:https://www.cnblogs.com/HaoKeKe/p/4475359.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值