So, we should all know about the jQuery document-ready handler:
$(function () {
// stuff here
});
So basically, if the first parameter for the $ function is a function, then we run it on document startup, right?
Then why won’t this work?
$(foo());
When you type
$(foo());you are actually callingfooand pass the result to$. If you want to usefooas a callback, you need to type$(foo).