点击jQuery的调用不工作的按钮,点击

点击jQuery的调用不工作的按钮,点击

问题描述:

我想如下写一个简单的代码:点击jQuery的调用不工作的按钮,点击

<html> 
    <head> 
     <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js" /> 
    <script> 
     $("#submitQuery").click(function() { 
      alert("Hola!!"); 
     }); 
    </script> 
    </head> 
    <body> 
     <label for="geo_location"> Enter location here: </label> 
     <input id="geo_location" type="text" name="geo_location" required /> 
     <button id="submitQuery">Find out</button> 
     <div id="test"></div> 
    </body> 
</html> 

但是,单击该按钮不会做任何事情。我在哪里错了?

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js" /> </script> 
<script> 
    $(function(){ 
     $("#submitQuery").click(function() { 
      alert("Hola!"); 
     }); 
    }); 
</script> 

试试这个...你错过了功能齐全..