jquery - how to show a hidden div

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)

<divhidden";></div> 

Anyone can help me with the related jquery codes?

2

4 Answers

Try

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

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

$('#map').show(); 
4

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

Try this:

<div;></div> $("#map").show(); 

Here is a jsfiddle:

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

But visibility:hidden is better than display:none if you want to use jQuery to hide it. Because jQuery's .show() function overlays some of the page elements like anchor tags, preventing click events.

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like