[英]Learning jQuery, but nothing is happening?
我正在尝试使用jQuery,但由于某种原因,当我点击一个按钮时没有发生任何事情。 我试过在很多方面操纵代码,但仍然没有任何反应
我正在使用Firefox,javascript工作正常。
这是我的代码:
<!DOCTYPE html>
<html>
<head>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js"></script>
<style>
body {
background-color:royalblue;
margin:0px;
}
#div_header {
background-color:black;
height:200px;
}
</style>
<script type="text/javascript">
$(document).ready(function() {
$("button").click(function() {
$("#div_header").hide();
});
});
</script>
</head>
<body>
<div id="div_header">
<button type="button">Click me!</button>
</div>
</body>
</html>
脚本源值不正确。 将其更改为
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js"></script>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.