Reputation: 12224
I have a div as part of a page that is rendered like this:
<div id="productdiv" style="visibility:hidden;">
Upon a certain event, I want this div to become visible.
The following does not work:
$("#productdiv").show();
What will work?
Upvotes: 0
Views: 48
Reputation: 5734
$('.asdf').click(function(){
$("#productDiv").css('visibility','visible');
});
Upvotes: 0
Reputation: 3274
you should try something like this
$("#productdiv").css("visibility","visible");
or use this to set multiple CSS properties for ALL matched elements:
$("#productdiv").css({"visibility":"visible","font-size":"50px"});
Upvotes: 2
Reputation: 4042
The show
function sets the display
css attribute. Use $("#productdiv").css("visibility", "visible");
instead.
Upvotes: 0
Reputation: 474
The show method works for the display property, not the visibility property. Use, .css('visibility', 'visible')
...
Upvotes: 0
Reputation: 14302
Use display:none;
instead of visibility:hidden;
Example
Replace this :
<div id="productdiv" style="visibility:hidden;">
With
<div id="productdiv" style="display:none;">
Upvotes: 2