jQuery installa...LOGIN

jQuery installation

Download jQuery

For jQuery library files, we can go to the "jQuery official website" to download

There are actually 2 types of jQuery library files: (1) development version; (2) release version .

The development version is not compressed and provides developers with the source code to learn jQuery. It is usually named jquery.js. The release version is compressed and allows us to use jQuery, usually named jquery.min.js.

The jQuery library is a JavaScript file that you can reference using the HTML <script> tag:

<head>
<script src="jquery- 1.10.2.min.js"></script>
</head>

Tips: Place the downloaded file in the same directory of the web page. jQuery can be used.

Note: Please remember, do not touch the source code in this file casually.


Alternatives CDN

If you don’t want to download and host jQuery, you can also distribute it through a CDN (Content Distribution Network) network) cite it.

The servers of Baidu, Youpaiyun, Sina, Google and Microsoft all have jQuery.

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: All examples on this site use Baidu jQuery CDN library.

To quote jQuery from Baidu, Youpaiyun, Sina, Google or Microsoft, please use one of the following codes:

Baidu CDN:

<head>
<script src="http://libs.baidu.com/jquery/1.10.2/jquery.min.js"></script>
</head>

Zaipaiyun CDN:

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

Sina CDN:

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

Google CDN:

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

Note: It is not recommended to use Google CDN to obtain the version, because Google products are very unstable in China.

Microsoft CDN:

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

There is a big advantage in using Baidu, Youpaiyun, Sina, Google or Microsoft's jQuery.

Next Section
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>php中文网(php.cn)</title> <script src="http://libs.baidu.com/jquery/1.10.2/jquery.min.js"></script> </head> <body> <div id="divMsg">这是正常的内容</div> <input id="btnChange" type="button" value="修改内容为 我是替换的内容" /> <script type="text/javascript" > $("#btnChange").bind("click", function(event) { $("#divMsg").html("我是替换的内容"); }); </script> </body> </html>
submitReset Code
ChapterCourseware