jquery中ready函数,$(function(){})与自执行函数的区别
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
<script type="text/javascript" src="js/jquery-1.12.1.js"></script>
<script type="text/javascript">
/**
* jQuery中的ready函数
*
*/
var jq = jQuery(document);
/*jQuery(document).ready(function(){
console.log("ready1")
});
jQuery(document).ready(function(){
console.log("ready2")
});*/
jq.ready(function(){
console.log("ready1")
});
jq.ready(function(){
console.log("ready2")
});
(function(){
console.log("自执行")
})();
$(function(){
console.log("jquery 自执行");
});
//console.log(jQuery(document) === jQuery(document))
</script>
</head>
<body>
</body>
</html>
jquery中ready函数,$(function(){})与自执行函数的区别的更多相关文章
- jQuery中ready与load事件
jQuery中ready与load事件(来自慕课网) jQuery有3种针对文档加载的方法 $(document).ready(function() { // ...代码... }) //docume ...
- 不能调用jquery中ready里面定义的函数?
现象:不能调用jquery中ready里面定义的函数 源码:<script type="text/javascript"> $(document).ready(func ...
- jQuery中ajax如何返回值到上层函数
jQuery中ajax如何返回值到上层函数 一.总结 一句话总结: ajax的同步操作即可,设置 async: false, 二.jquery的同步操作 var can_submit=true; $. ...
- onload函数和自执行函数的区别(jquery API网址:http://jquery.cuishifeng.cn/)
<!DOCTYPE html><html lang="en"><head> <meta charset="UTF-8" ...
- jQuery中ready与load事件的区别
1.摘要 大家在编程中使用jQuery还有JS的时候一定会在使用之前这样: //document ready $(document).ready(function(){ ...code... }) / ...
- jQuery中ready方法的实现
https://blog.csdn.net/major_zhang/article/details/80146674 先普及一下jquery.ready()和window.onload,window. ...
- jQuery 中ready与load事件
jquey有3种针对文档加载的方法: //document ready $(document).ready(function(){ //...代码... }) //document ready 简写 ...
- jQuery中ready和load的区别
<span style="white-space:pre"> </span>//document ready $(document).read ...
- javascript (function() { /* code */ })() 自执行函数
(function(){ function a(){ alert("a"); } })(); 自执行匿名函数: 常见格式:(function() { /* code */ })() ...
随机推荐
- Balanced Substring
You are given a string s consisting only of characters 0 and 1. A substring [l, r] of s is a string ...
- osquery简单试用
备注: osquery facebook 开源的将操作系统指标转换为sql 查询,方便好用,很适合devops 性能分析,系统监控 1. 安装 参考 https://osquery.io/downl ...
- Automating CSS Regression Testing
The following is a guest post by Garris Shipon . We've touched on the four types of CSS testing here ...
- jsTree 是一个基于Javascript,支持多浏览器的Tree view jQuery插件。
https://www.jstree.com/ 之前给大家介绍两种浮动闭合的办法CSS清除浮动 万能float闭合,得 http://www.daqianduan.com/3606.html
- Linux环境下Maven的.m2文件夹
aven中的.m2文件夹 安装完maven是没有.m2文件夹的.在linux中以.开头的文件夹都是隐藏的.当使用maven命令的时候,maven自动会创建.m2文件夹. 运行命令mvn help:sy ...
- FastAdmin env.sample 的用法
FastAdmin env.sample 的用法 在 FastAdmin 的 1.0.0.20180513 中我提交了一个 PR,增加 env.sample 内容如下: [app] debug = f ...
- python官网
https://www.python.org/ https://docs.python.org/2/library/pydoc.html
- 【JS】手机屏幕旋转判断
function readDeviceOrientation() { if (Math.abs(window.orientation) === 90) { // Landscape alert('横屏 ...
- java代码----substring()方法是按索引截取字符串。。。下标0开始
总结:按照索引substring(2,5);意思是从字符串的索引为2开始(包括)到第6个字符(不包括)的位置的截取部分 package com.s.x; //substring public clas ...
- ActiveMQ的多种部署方式--ActiveMQ学习之二
单点的ActiveMQ作为企业应用无法满足高可用和集群的需求,所以ActiveMQ提供了master-slave.broker cluster等多种部署方式,但通过分析多种部署方式之后我认为需要将两种 ...