jQuery安装

jQuery可以通过多种方法在网页中加载,一般可以常用两种方法:

  1. 从jquery.com下载jQuery库
  2. 从CDN中加载,比如Google中加载jQuery,常见的CDN有:
// 百度
<script src="https://apps.bdimg.com/libs/jquery/2.1.4/jquery.min.js">

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

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

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

// Microsoft(微软)
<script src="https://ajax.aspnetcdn.com/ajax/jquery/jquery-1.9.0.min.js"></script>

版本说明

官网上面有两个版本可以下载:

  1. production version:生产环境中,此版本是已经被精简和压缩过的;
  2. development version:常用于开发和测试,此版本的代码是可读的。

jQuery库是一个JavaScript文件,可以直接在HTML的