爲什麼在頁面加載時不起作用,但是當我將jquery粘貼到控制檯中時,它可以工作。JQuery在粘貼到控制檯時起作用,但在頁面加載時不起作用
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Alex Cory</title>
<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/latest/css/bootstrap.min.css">
</head>
<body id="page-top" data-spy="scroll" data-target=".navbar-custom">
<div id="root"></div>
<script src="src/app.js"></script>
<script src="//code.jquery.com/jquery-2.2.3.min.js" integrity="sha256-a23g1Nt4dtEYOj7bR+vTu7+T8VP13humZFBJNIYoEJo=" crossorigin="anonymous"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery-easing/1.3/jquery.easing.min.js"></script>
<script src="//maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js" integrity="sha384-0mSbJDEHialfmuBBQP6A4Qrprq5OVfW37PRR3j5ELqxss1yVqOtnepnHVP9aJ7xS" crossorigin="anonymous"></script>
<script>
$(document).ready(function(){
$('.page-scroll a').bind('click', function(event) {
console.log('CLICKED BUTTON! ^_^');
event.preventDefault();
});
});
</script>
</body>
</html>
哪裏有問題'$(「頁面滾動一個」)的元素' –