title: 2.安装jquery
tags: 2019-10-30
notebook: JQuery
1.在网页中添加jquery的方法
- 从[jquery.com][1]下载jquery库
- 从CDN中载入jquery
2.jquery的两种版本
- Production Version-用于实际的网站中,已被精简和压缩
- Development Version-用于测试和开发(未被压缩,是可读的代码)
在HTML中引入jquery
<head>
<script src="jquery-1.10.2.min.js"></script>
</head>
为什么没有在script中使用type="text/javascript?:因为JavaScript 是 HTML5 以及所有现代浏览器中的默认脚本语言!
替代方案:
-
百度CDN
<head> <script src="http://libs.baidu.com/jquery/1.10.2/jquery.min.js"></script> </head>
-
又拍云CDN
<head> <script src="http://upcdn.b0.upaiyun.com/libs/jquery/jquery-2.0.2.min.js"></script> </head>
-
新浪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>
-
Microsoft CDN
<head> <script src="http://ajax.htmlnetcdn.com/ajax/jQuery/jquery-1.10.2.min.js"></script> </head>