我是靠谱客的博主 迷人鞋垫,最近开发中收集的这篇文章主要介绍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

最后

以上就是迷人鞋垫为你收集整理的JQuery判断div(控件)是否为隐藏的全部内容,希望文章能够帮你解决JQuery判断div(控件)是否为隐藏所遇到的程序开发问题。

如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(59)

评论列表共有 0 条评论

立即
投稿
返回
顶部