I'm trying to use jQuery, but for some reason nothing is happening when I click a button. I've tried manipulating the code in many ways, but still nothing happens
I'm using Firefox, and javascript works fine.
Here's my code:
<!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>
The script source value is incorrect. Change it to
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js"></script>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.