这之间有区别吗:
$(document).ready(function() {
还有这个:
$().ready(function() {
最佳答案
根据jquery documentation他们是一样的。
All three of the following syntaxes are equivalent:
$(document).ready(handler)
$().ready(handler) // this is not recommended
$(handler)
我个人认为使用 $(document).ready(handler)
使其更具可读性。
关于javascript - jQuery Document Ready 函数语法,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8990608/