是否可以将定义的函数作为jQuery的$(document).ready()而不是匿名函数的处理程序?
我做了几次实验,但无济于事.其中一个在这里:http://pastebin.com/XHKPc879.
对的,这是可能的:
function pancakes() { /* Do interesting things */ }
$(document).ready(pancakes);
Run Code Online (Sandbox Code Playgroud)
你的pastebin的问题:
$(document).ready(test());
Run Code Online (Sandbox Code Playgroud)
test当你说时test(),你正在调用这个函数,只要放下括号就可以了.