Copied from the server side error jquery $ undefined!

  Jquery tried to see the video yourself, find Jquery library can not be downloaded, points directly into the server version of the code is. So I direct in vscode a new js file, the server-side code directly copied into it, creating a local Jquery file, and then referenced in the html file. as follows: 

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>2.jquery_hello world</title>
    <script src="jquery.js"></script>
</head>
<body>
    <script>
        $(document).ready(function(){
            alert("hello world!");
        });
    </script>
</body>
</html>

However, do not run, the error is: $ undefined. The solution is server-side js introduced. The first script tag into:

<script src="http://code.jquery.com/jquery-3.4.1.min.js"></script>

 Problem solving, the browser can always operate normally. But I do not know why the local copy js useless. . . .

 

 

  

Published an original article · won praise 0 · Views 42

Guess you like

Origin blog.csdn.net/worthyyyou/article/details/103938580