Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

jquery - how to show a hidden div

Tags:

html

jquery

I have a google map embedded in my page whose visiblity is set to hidden. Using a button i want to show the map on the page. Should be done using jquery.

my code - (not working)

<div id="map" style="height: 350px; border: 1px solid #979797;visibility="hidden";></div>

Anyone can help me with the related jquery codes?

like image 260
Parvesh Avatar asked May 23 '12 14:05

Parvesh


People also ask

What does show () do in jQuery?

jQuery Effect show() Method The show() method shows the hidden, selected elements. Note: show() works on elements hidden with jQuery methods and display:none in CSS (but not visibility:hidden).

How check DIV is hidden or not in jQuery?

To check if an element is hidden or not, jQuery :hidden selector can be used. .toggle() function is used to toggle the visibility of an element.

How do I toggle Show hide in jQuery?

jQuery toggle() MethodThe toggle() method toggles between hide() and show() for the selected elements. This method checks the selected elements for visibility. show() is run if an element is hidden. hide() is run if an element is visible - This creates a toggle effect.

What does jQuery hide () do?

jQuery hide() Method The hide() method hides the selected elements. Tip: This is similar to the CSS property display:none. Note: Hidden elements will not be displayed at all (no longer affects the layout of the page). Tip: To show hidden elements, look at the show() method.


2 Answers

Try

$('#map').css('visibility','visible');

Actually, if style has display:none, you can use jquery function

$('#map').show();
like image 198
bitoshi.n Avatar answered Sep 16 '22 19:09

bitoshi.n


Your style="" tag is also incorrect. You should have this: visibility: hidden;

Try this:

<div id="map" style="height: 350px; border: 1px solid #979797; display: none";></div>

$("#map").show();
like image 31
Adam Levitt Avatar answered Sep 20 '22 19:09

Adam Levitt