如何在jquery中将div元素的visible属性设置为true或false?

我想能够做到这一点:
$(".panel").visible = true;

但这不行

解决方法

对于显示CSS属性,使用 .show(),.hide() or .toggle()影响是否显示,如下所示:
$(".panel").show();
//or to hide:
$(".panel").hide();
//toggle show/hide
$(".panel").toggle();
//or show/hide based on boolean:
$(".panel").toggle(bool);

对于CSS属性的可见性,您需要手动设置(jQuery主要是围绕显示构建的),使用.css()这样:

$(".panel").css("visibility","visible");
//or:
$(".panel").css({ visibility: "visible"});

相关文章

页面搜索关键词突出 // 页面搜索关键词突出 $(function () {...
jQuery实时显示日期、时间 html: <span id=&quot...
jQuery 添加水印 <script src="../../../.....
中文:Sys.WebForms.PageRequestManagerParserErrorExceptio...
1. 用Response.Write方法 代码如下: Response.Write(&q...
Jquery实现按钮点击遮罩加载,处理完后恢复 思路: 1.点击按...