jQuery的环境搭建
搭建jQuery的运行环境
提供三个路径下载:
1.jQuery 的在线引入 路径。
http://code.jquery.com/jquery-3.1.1.min.js
上面的地址是总下载列表, 里面有很多版本和类型的 jQuery 库, 主要分为如下几类:
min: 压缩后的 jQuery 类库, 在正式环境上使用.如:jquery-3.1.1.min.js
vsdoc: 在 Visual Studio 中需要引入此版本的 jquery 类库才能启用智能感知.如:jquery-3.1.1-vsdoc2.js
release包: 里面有没有压缩的 jquery 代码, 以及文档和示例程序. 如:jquery-3.1.1-release.zip
2.也可在 jQuery 的官网中下载最新版本,下载地址:http://jquery.com/download/
下载后是一个 js 文件,我们只需要在 html 文件中引入这个 js 文件,便可。
3.在包含源码的 github 地址中也有 jQuery 的最新版本提供下载,地址为:
https://github.com/shiyanlou/jQuery-base-code
注:github 地址中包含的 jquery-3.1.1js 版本是本次课程中用到的文件,jquery-1.11.2.min.js 是发布课程之时 jQuery 的最新版本,且是压缩版。
新建文件
<!doctype html>
<html lang="zh">
<head>
<meta charset="utf-8"/>
<title>Hello World jQuery!</title>
<script src="http://code.jquery.com/jquery-3.1.1.min.js"></script>
</head>
<body>
<div id="divMsg">Hello jQuery!</div>
<input id="btnShow" type="button" value="show" />
<input id="btnHide" type="button" value="hidden" /><br/>
<input id="btnChange" type="button" value="change content is Hello World, too!"/>
<script>
$("#btnShow").bind("click", function(event) {
$("#divMsg").show();
});
$("#btnHide").bind("click", function(event) {
$("#divMsg").hide();
});
$("#btnChange").bind("click", function(event) {
$("#divMsg").html("Hello World, too!");
});
</script>
</body>
</html>
预览
Clear
- 课程推荐
- 课件下载
课件暂不提供下载,工作人员正在整理中,后期请多关注该课程~ 















