In this section, we learn
jQuery Installation , We are in the actual project , If you want to use
jQuery, You need to download
jQuery library , Then introduce it into the web page to be used .
jQuery There are several ways to use ：
- Download from official website
jQuerylibrary , Then introduce it into the page .
- Install with command
jQuery, for example
CDNIn the load
jQuery, For instance from
We Can be in
jQuery Download on
jQuery, Download at ：https://jquery.com/download/.
There are two versions
jQuery Available for download ：
- Production version ： Used in actual websites , Has been reduced and compressed .
- Development version ： For testing and development , non-compressed , Is readable code .
We download the corresponding version as needed , For example, I downloaded
jquery-3.5.1.min.js file , Then you can put the downloaded files in the same directory as the web page , This is more convenient to use .
Then you can introduce... Into the page
jquery Documents , The import format is as follows ：
Use npm install jQuery
npm Register as a package on , So we can use it
npm CLI Command to install the latest version of
npm install jquery
Yarn Command installation can also ：
yarn add jquery
Use these two methods to install
jQuery, We can do it in
node_modules/jquery/dist/ Found an uncompressed distribution in , A compressed distribution and a mapping file .
Use Bower install jQuery
jQuery And through
Bower Register as package , So we can also use
bower Command to install the latest version of
bower install jquery
In this way , Will
jQuery The installation to
Bower Installation directory , The default is
bower_components. We can do it in
bower_components/jquery/dist/ An uncompressed distribution was found in the directory , A compressed distribution and a mapping file .
take jQuery And CDN Use it together
If we don't want to download and store
jQuery Words , We can also from
CDN（ Content distribution network ） Quote it .
CDN It is an intelligent virtual network based on the existing network , Rely on edge servers deployed everywhere , Load balancing through the central platform 、 content distribution 、 Scheduling and other functional modules , Let users get the content they need nearby , Reduce network congestion , Improve user access response speed and hit rate .
For example, both Google and Microsoft servers have
jQuery, If we need to quote , It can be like this ：
We talked about
jQuery There are several ways to install , In the following learning chapters , We will download directly on the official website
jQuery library , Then use... By referencing in the page