The introduction of jquery appears: Uncaught ReferenceError: $ is not defined error
The html code is as follows:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
</head>
<body>
用户名:<input id="inputId" type="text" name="username" value="学编程"/>
<script type="text/javascript">
//2:获取输入框架
var $inputId = $("#inputId");
// 3:获取value对应的值
alert($inputId.val());
</script>
<script src="js/jquery-3.1.0.min.js"></script>
</body>
</html>
Check the browser network. Found that the introduction of jquery is successful, the status is 200
After consulting the relevant information, it was found that the order introduced by jquery was wrong
[External link image transfer failed, the source site may have an anti-leeching mechanism, it is recommended to save the image and upload it directly (img-HnX1kajK-1600308375472)(
)]
Modified code:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
</head>
<script src="js/jquery-3.1.0.min.js"></script>
<body>
用户名:<input id="inputId" type="text" name="username" value="学编程"/>
<script type="text/javascript">
//2:获取输入框架
var $inputId = $("#inputId");
// 3:获取value对应的值
alert($inputId.val());
</script>
</body>
</html>
running result: