进入jQuery官网:http://jquery.com/

点击Download jQuery v3.1.1--->下载最新版本的jQuery版本--->放到你需要引入jQuery的文件中。

简单示例(引入jQuery文件):

接下来就可以进行你自己需要的jQuery操作了!!

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
</head>
<body>
</body>
<script src="js/jquery/jquery-1.11.3.min.js"></script>
<script type="text/javascript">
$(function(){
//添加你需要的jQuery操作
});
</script>
</html>

初步工作完成!

小示例:

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
</head>
<body>
</body>
<script src="js/jquery/jquery-1.11.3.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
alert("hello world1111!");
});
//===等价===
$(function(){
alert("hello world2222!");
});
</script>
</html>

结果:弹出对话框(两次都会执行)

===================================================================================

  <script type="text/javascript">
$(document).ready(function(){
alert("hello world1111!");
});
//===等价===
$(function(){
alert("hello world2222!");
});
</script>

关于$(document).ready(function(){//....});和$(function(){//......}); (可编写多个,执行多个)

$(function(){//......});是$(document).ready(function(){//....});的简写形式,这两种是等价的!

同时他们和JavaScript中的window.onload();方法相同,但又有区别。

window.onload方法的使用:(不可以编写多个,一个页面只能有一个、多个时只执行最后一个)

<script type="text/javascript">
window.onload = function(){
alert("111111111");
};
window.onload = function(){
alert("2222222");
};
window.onload = function(){
alert("3333333");
};
</script>

输出为:

最新文章

  1. CocoaPods安装流程
  2. 虚拟机安装Ubuntu到U盘
  3. c#中高效的excel导入sqlserver的方法
  4. Sphinx 之 Coreseek、Sphinx-for-chinaese、Sphinx+Scws 评测
  5. 我的android学习经历11
  6. Unique Binary Search Trees II
  7. angular中的orderBy过滤器使用
  8. 2299 Ultra-QuickSort(归并)
  9. mac配置java和maven环境变量
  10. xamarin android制作圆角边框
  11. 如何让oracle DB、监听和oem开机启动(dbstart)
  12. 非vue-cli的花括号闪现问题
  13. javascript的作用域和闭包(三)闭包与模块
  14. 进入页面就触发了popstate事件。
  15. Nginx PRECONTENT try_files指令
  16. gsl库安装
  17. Software-Defined Networking A Comprehensive Survey --阅读_day1
  18. 一些常用SQL语句大全
  19. IDA .edata .rdata .idata .text segments
  20. js-jquery-SweetAlert2【一】使用

热门文章

  1. apache 列目录修复
  2. exit() 与 return() 的区别
  3. Python之文件操作:文件的读写
  4. Bzoj2829 信用卡凸包
  5. 洛谷 P1027 Car的旅行路线
  6. sql按照汉字首字母顺序排序(桃)
  7. linux(debian)安装USB无线网卡(tp-link TL-WN725N rtl8188eu )
  8. python print的参数介绍
  9. Fresco使用之OOM问题记录
  10. (4)ASP.NET内置对象1