How do I set a visible property of a div element to true or false in jquery?
I would like to be able to do this:
$(".panel").visible = true;
but this 开发者_JS百科doesn't work.
For the display
CSS property, use .show()
, .hide()
or .toggle()
to affect whether it displays, like this:
$(".panel").show();
//or to hide:
$(".panel").hide();
//toggle show/hide
$(".panel").toggle();
//or show/hide based on boolean:
$(".panel").toggle(bool);
For the visibility
CSS property, you need to set it manually (jQuery is mostly built around display
), using .css()
like this:
$(".panel").css("visibility", "visible");
//or:
$(".panel").css({ visibility: "visible"});
For me this worked:
document.getElementById('my_elementid').style.visibility='visible';
you can by using ClientScript on serverside call your jquery method
ClientScript.RegisterStartupScript(this.GetType(), "hideslidertab", "hideslidertab();", true);
精彩评论