I would like to be able to do this:
$(".panel").visible = true;
but this doesn't work.
To toggle a div visibility in jQuery, use the toggle() method. It checks the div element for visibility i.e. the show() method if div is hidden. And hide() id the div element is visible. This eventually creates a toggle effect.
visibility = 'visible'; If you are using jQuery, you can do it even easier as long as you want to set the display property: $(elem). hide(); $(elem).
You can then use the jQuery hide() and show() functions. Show activity on this post. Set the CSS property visibility to visible . Show activity on this post.
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';
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With