所以我試圖把我的jquery放在一個保存爲script.js的js文件夾中,然後在我的html中調用該文件。所以我試圖在我的CSS之前調用它,在我的CSS之後,甚至剛好在我的末端還沒有運行我的jquery的地方。任何人都能識別我的問題?以下是我試圖打電話給我的script.js在我的index.php即使將jquery包含在我的html中後,jquery仍然沒有運行
<!DOCTYPE HTML>
<html>
<head>
<?php include '/php/db.php'; ?>
<link rel="stylesheet" href="style.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.0/jquery.min.js"></script>
<script type = "text/javascript" src="js/script.js"></script>
<link href="https://fonts.googleapis.com/css?family=Josefin+Sans" rel="stylesheet">
<link href="https://fonts.googleapis.com/css?family=Paprika" rel="stylesheet">
<title>YFC</title>
</head>
<body>
<div id = "container" method="post">
<div class="signup">
<h1>Sign up</h1>
<form action="/action_page.php">
<input class="pop" type="text" name="Sname" placeholder="Fill in your name!"><br><br><br>
<input class="pop" type="password" name="Slastname" placeholder="Fill in your last name!"><br><br><br>
<input class="pop" type="text" name="Susername" placeholder="Fill in your username!"><br><br><br>
<input class="pop" type="password" name="Spassword" placeholder="Fill in your password!"><br><br><br>
<input class="pop" type="password" name="SRpassword" placeholder="Repeat your password!"><br><br><br>
<input class="sbutton" type="submit" value="Submit">
</form>
</div>
<div class="signin">
<h1>Log in</h1>
<form action="/action_page.php" method="post">
<input class="pop" type="text" name="Lusername" placeholder="Fill in your username!"> <br><br><br>
<input class="pop" type="password" name="Lpassword" placeholder="Fill in your username!"> <br><br><br>
<input class="lbutton" type="submit" value="Log in">
</form>
</div>
</div>
</body>
</html>
這裏是我的jQuery代碼
$('.pop').mouseenter(function(){
$(this).css('width',300);
});
$('.pop').mouseleave(fucntion(){
$(this).css('width',280)
});
嘗試包裝你這個'$(文件)的內部代碼。就緒(函數(){ })' –
你在瀏覽器的控制檯中遇到什麼錯誤? – j08691