<!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(){})与自执行函数的区别的更多相关文章

  1. jQuery中ready与load事件

    jQuery中ready与load事件(来自慕课网) jQuery有3种针对文档加载的方法 $(document).ready(function() { // ...代码... }) //docume ...

  2. 不能调用jquery中ready里面定义的函数?

    现象:不能调用jquery中ready里面定义的函数 源码:<script type="text/javascript"> $(document).ready(func ...

  3. jQuery中ajax如何返回值到上层函数

    jQuery中ajax如何返回值到上层函数 一.总结 一句话总结: ajax的同步操作即可,设置 async: false, 二.jquery的同步操作 var can_submit=true; $. ...

  4. onload函数和自执行函数的区别(jquery API网址:http://jquery.cuishifeng.cn/)

    <!DOCTYPE html><html lang="en"><head> <meta charset="UTF-8" ...

  5. jQuery中ready与load事件的区别

    1.摘要 大家在编程中使用jQuery还有JS的时候一定会在使用之前这样: //document ready $(document).ready(function(){ ...code... }) / ...

  6. jQuery中ready方法的实现

    https://blog.csdn.net/major_zhang/article/details/80146674 先普及一下jquery.ready()和window.onload,window. ...

  7. jQuery 中ready与load事件

    jquey有3种针对文档加载的方法: //document ready $(document).ready(function(){ //...代码... }) //document ready 简写 ...

  8. jQuery中ready和load的区别

    <span style="white-space:pre">        </span>//document ready $(document).read ...

  9. javascript (function() { /* code */ })() 自执行函数

    (function(){ function a(){ alert("a"); } })(); 自执行匿名函数: 常见格式:(function() { /* code */ })() ...

随机推荐

  1. simulink中几个bit型操作模型

    bit concat  将两个fix point 数据 结合到一块. bit rotate 循环移位 bit shift 移位 又分逻辑移位和算术移位,逻辑移位不管最高位0或1,统统移0,算术移位会移 ...

  2. webpack libray 参考例子

    备注:   使用webpack 进行模块导出,方便进行通信 1. 项目初始化 ├── main.js ├── package.json ├── show.js ├── webpack.config.j ...

  3. php替换 json符号

  4. Java API 操作Redis

    针对Redis的Java客户端有很多种,具体查看官网信息:https://redis.io/clients#java 本次测试使用Jedis API,Jedis使用方便,其api方法名称与redis命 ...

  5. mysql设置合适的索引长度

    理想的索引: 相对于写操作来说,表查询很频繁的表建立索引 字段区分度高 长度小(合适的长度,不是越小越好) 尽量能够覆盖常用字段 这些条件综合起来才能够达到最优索引,本次我们着重聊一下建立合适长度的索 ...

  6. pandas之Dataframe转成dict+过滤+index去重

    转成字典a = ['key1', 'key2', 'key3']b = ['1', '2', '3']data = pd.DataFrame(zip(a, b), columns=['project' ...

  7. Python基本序列-字典

    Python 基本序列-字典 字典(dict)是"键-值 对"的无序可变序列,字典中的每个元素包含两部分,"键"和"值". 字典中的&quo ...

  8. Ten Qualities of an Effective Team Player

    If you were choosing team members for a business team in your organization, who would the best team ...

  9. Zookeeper--Watcher 和 ACL

    Zookeeper--Watcher 和 ACL Watcher (观察) Zookeeper中的znode可以被监控,这是zk的核心特性. 通过exists,getChildren和getData这 ...

  10. EasyUI treegrid 删除一条或多条记录

    function del_dg() { $.messager.defaults = { ok: "是", cancel: "否" }; var node = $ ...