2017-07-25 59 views
0

当我按一下按钮没有任何反应,我找不到我的错误:jQuery的文件加载不被称为

<html> 
<head>  
<script type="text/javascript" src="jquery-3.2.1.min.js" /> 
</head> 
<body> 

<script type="text/javascript">  
$(document).ready(function(){ 
    $("#btnSubmit").click(function(){ 
     alert("button"); 
    }); 
}); 

</script> 
<input id = "btnSubmit" type="submit" value="Release"/> 
</body> 
</html> 

你可以给我一个兴?

+0

您的脚本标记未正确关闭。即使是上面的语法荧光笔也能捕捉到它。 – j08691

+0

[JavaScript控制台]中的任何错误(https://webmasters.stackexchange.com/questions/8525/how-to-open-the-javascript-console-in-different-browsers)?对于初学者,您的'' –

回答

1

试试看看这个代码。

<html> 
<head>  
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script> 
</head> 
<body> 

<script type="text/javascript">  
$(document).ready(function(){ 
    $("#btnSubmit").click(function(){ 
     alert("button"); 
    }); 
}); 

</script> 
<input id = "btnSubmit" type="submit" value="Release"/> 
</body> 
</html> 
+0

我已经添加了jquery CDN,所以你可以用你自己的本地jquery文件路径替换。 –