Hi I am never that good at JQuery so decided to spend some time to really enhance my skill, I found this really good tut, but there is one thing I don't understand.
In this http://www.jquery-tutorial.net/intro...e-ready-event/ .ready method, the last example use an overload function,
the previous two examples both have $(document).ready(....
the above one doesn't have it.
What I try to understand is how does JQ know it is $(document).ready? or is it be default the overload has to be $(document).ready?
Please pardon me for the dumb question, if someone can help me to understand it, I greatly appreciate.
It's just a shorter way of specifying a document ready event handler. jQuery simply checks if the argument to $() is a function, and if it is it assumes it's a handler for the document ready event.
Thanks for the reply refeezed. So you mean by default JQ will use it in document.ready? Did I understand correctly?
What if I want to use it in other methods other than .ready()?
If the argument is a function, then yeah. If you want to listen for other events than the "ready" event you can use the .on() method. Example:
Originally Posted by MacPC
Last edited by ReFreezed; 01-11-2013 at 02:46 PM.
Oh, thanks a million, now I understand.
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)