what is jquery? and its calling method

What is jQuery?

jQuery is a JavaScript function library.

jQuery is a lightweight "write less, do more" JavaScript library.

The jQuery library contains the following functions:

  • HTML element selection
  • HTML element manipulation
  • CSS manipulation
  • HTML event functions
  • JavaScript effects and animations
  • HTML DOM traversal and modification
  • AJAX
  • Utilities

Tip:  In addition to this, Jquery also provides a large number of plugins.




Add jQuery to the web page

jQuery can be added to a web page in a number of ways. You can use the following methods:

  •  Download the jQuery library from  jquery.com
  • Load jQuery from CDN, such as jQuery from Google



Download jQuery

There are two versions of jQuery available for download:

  • Production version - used in the actual website, stripped down and compressed.
  • Development version - for testing and development (uncompressed, readable code)

Both versions above can be downloaded from  jquery.com  .


alternative plan

If you don't want to download and store jQuery, you can also reference it through a CDN (Content Delivery Network).

Baidu, Youpaiyun, Sina, Google and Microsoft all have jQuery on their servers.

If your site users are domestic, it is recommended to use domestic CDN addresses such as Baidu, Youpaiyun, Sina, etc. If your site users are foreign, you can use Google and Microsoft.

Note: The examples on this site all use the rookie tutorial CDN library.

To reference jQuery from Rookie Tutorial, Youpaiyun, Sina, Google, or Microsoft, use one of the following codes:

菜鸟CDN<script src="http://cdn.static.runoob.com/libs/jquery/1.10.2/jquery.min.js">

百度CDN<script src="https://apps.bdimg.com/libs/jquery/2.1.4/jquery.min.js">

有拍云CDN<script src="http://upcdn.b0.upaiyun.com/libs/jquery/jquery-2.0.2.min.js">

新浪CDN<script src="http://lib.sinaapp.com/js/jquery/2.0.2/jquery-2.0.2.min.js">

googleCDN<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>

Microsoft CDN<script src="http://ajax.htmlnetcdn.com/ajax/jQuery/jquery-1.10.2.min.js">

使用百度、又拍云、新浪、谷歌或微软的 jQuery,有一个很大的优势:

许多用户在访问其他站点时,已经从百度、又拍云、新浪、谷歌或微软加载过 jQuery。所以结果是,当他们访问您的站点时,会从缓存中加载 jQuery,这样可以减少加载时间。同时,大多数 CDN 都可以确保当用户向其请求文件时,会从离用户最近的服务器上返回响应,这样也可以提高加载速度。


Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325989801&siteId=291194637