Javascript来显示隐藏的div

Javascript来显示隐藏的div,javascript,jquery,html,Javascript,Jquery,Html,我想在满足以下条件时显示一个隐藏的div <script> jQuery.getJSON('http://freegeoip.net/json/', function(location) { if (location.country_code == 'AU') { jQuery.show(jQuery('#aus')); } }); </script> <div id="aus" style="display:none;"> &

我想在满足以下条件时显示一个隐藏的div

<script>
jQuery.getJSON('http://freegeoip.net/json/', function(location) {
  if (location.country_code == 'AU') {
    jQuery.show(jQuery('#aus'));     
  }
});  
</script>

<div id="aus" style="display:none;">
<div class="bottomBar">

This..

</div>
</div>

jQuery.getJSON('http://freegeoip.net/json/,函数(位置){
如果(location.country_代码=='AU'){
show(jQuery('#aus');
}
});  
这
试试这个:

jQuery.getJSON('http://freegeoip.net/json/', function(location) {
  if (location.country_code == 'AU') {
    jQuery("#aus").show();    
  }
});

请仔细阅读:

首先,您应该将其包装在
文档中。准备好了吗?
,然后您需要使用以下语法:


div#aus将提供什么?:)@JoakimM:OP试图显示div
时,我使用了
div#aus
div#aus
#aus
之间没有区别。无论如何编辑。:)@gg11:很高兴这对我有帮助,兄弟:)
jQuery(function() { // Wait for DOM to be ready
    jQuery.getJSON('http://freegeoip.net/json/', function(location) {
      if (location.country_code == 'AU') {
        jQuery('#aus').show(); // Correct syntax for show method
      }
    });
});