这些jQuery ready函数之间有什么区别? [英] What is the difference between these jQuery ready functions?

查看:98
本文介绍了这些jQuery ready函数之间有什么区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

两者之间有什么区别

$(function(){

}); 

$(document).ready(function() { 

});

推荐答案

什么都没有.

此功能的行为类似于 $(document).ready(),因为它应该 用于包装其他$()

This function behaves just like $(document).ready(), in that it should be used to wrap other $()

您可以在源代码中看到它:

rootjQuery = jQuery(document);

...

} else if ( jQuery.isFunction( selector ) ) {
    return rootjQuery.ready( selector );
}

这篇关于这些jQuery ready函数之间有什么区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆