Home > Article > Web Front-end > How to reference jquery.min.js
How to reference jquery.min.js: First download the [jquery.min.js] file from the official website; then use the [3f1c4e4b6b16bbbd69b2ee476dc4f83a] tag to reference the local [jquery.min.js] file; finally reference it Just use the online [jquery.min.js] file.
The operating environment of this tutorial: windows7 system, jquery3.2.1&&jquery1.4.1 version, Dell G3 computer.
How to quote jquery.min.js:
1. Download the jquery.min.js
file from the official website, and then use 3f1c4e4b6b16bbbd69b2ee476dc4f83a
The tag refers to the local jquery.min.js file
<script type="text/javascript"src="https://cdn.bootcss.com/jquery/3.2.1/jquery.min.js"></script>
2. Referring to the online jquery.min.js
file
We can pass Write a URL in the src attribute to directly reference the online jquery file.
In fact, there are many websites that use jquery now. The browser will pre-download jquery when loading the website that used jquery before, so we don’t need to download it again, even if our jquery version is It is a new version that has not been loaded by the browser, and the jquery code will be downloaded very quickly. However, if you are still worried about affecting the loading speed, importing the jquery file locally is indeed the best way.
<script type="text/javascript"src="http://code.jquery.com/jquery-1.4.1.min.js"></script>
Note
Be sure to introduce the jQuery file first, and then write your own jquery code, because the loading order of the page is from top to bottom, the browser will load first Loading your jquery code and then loading the jquery library will cause your jquery code to be considered to be in the wrong writing format and the effect cannot be achieved.
<script src="jQuery文件路径"></script> <script> //在此书写你的jquery代码 </script>
Related free learning recommendations: javascript video tutorial
The above is the detailed content of How to reference jquery.min.js. For more information, please follow other related articles on the PHP Chinese website!