概述
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(控件)是否为隐藏所遇到的程序开发问题。
如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复