这些jQuery ready函数之间有什么区别? [英] What is the difference between these jQuery ready functions?
本文介绍了这些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屋!
查看全文