jQuery安装教程,下载或CDN引用多方法

如何在网页中添加jQuery?jQuery库是一个JavaScript文件,可以使用HTML的 <script> 标签引用它,通过其他云厂商提供的CDN在网页中添加jQuery。阿腾云atengyun.com分享多种安装jQuery的方法:

下载jQuery并引用

jQuery有两个版本的可供下载:

  • Production version – 用于实际的网站中,已被精简和压缩
  • Development version – 用于测试和开发(未压缩,是可读的代码)

以上两个版本都可以从jQuery官网中下载。

jQuery库是一个JavaScript文件,您可以使用HTML的 <script> 标签引用它:

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

CDN引用jQuery方法

如果你不想要下载并存放 jQuery,那么也可以通过 CDN(内容分发网络) 引用它。CDN引用可以选择从百度云、Staticfile CDN、又拍云、新浪、谷歌或微软引用jQuery等,例如:

百度CDN:

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

Staticfile CDN:

<head>
<script src="https://cdn.staticfile.org/jquery/1.10.2/jquery.min.js">
</script>
</head>

字节跳动:

<head>
<script src="https://lf3-cdn-tos.bytecdntp.com/cdn/expire-1-M/jquery/2.1.3/jquery.min.js">
</script>
</head>

又拍云CDN:

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

Google CDN:

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

新浪CDN:

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

Google CDN:

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

Microsoft CDN:

<head>
<script src="https://ajax.aspnetcdn.com/ajax/jquery/jquery-1.9.0.min.js"></script>
</head>

腾讯云服务器特价:https://curl.qcloud.com/oRMoSucP

阿里云服务器优惠:https://t.aliyun.com/U/bLynLC