jquery - 如何显示隐藏的 div
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/10721552/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
jquery - how to show a hidden div
提问by Parvesh
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.
我的页面中嵌入了一个谷歌地图,其可见性设置为隐藏。使用按钮我想在页面上显示地图。应该使用 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?
任何人都可以帮助我处理相关的 jquery 代码?
回答by bitoshi.n
Try
尝试
$('#map').css('visibility','visible');
Actually, if style has display:none
, you can use jquery function
其实,如果 style 有display:none
,你可以使用 jquery 函数
$('#map').show();
回答by Adam Levitt
Your style="" tag is also incorrect. You should have this: visibility: hidden;
您的 style="" 标签也不正确。你应该有这个:可见性:隐藏;
Try this:
尝试这个:
<div id="map" style="height: 350px; border: 1px solid #979797; display: none";></div>
$("#map").show();
回答by lucuma
Here is a jsfiddle: http://jsfiddle.net/lucuma/GhMbU/
这是一个 jsfiddle:http: //jsfiddle.net/lucuma/GhMbU/
$('div#map').css('visibility', 'visible')
$('div#map').css('visibility', 'visible')