Thursday, September 19, 2013

What do you always use in jQuery Code?

We need to ensure that the page is ready before our JavaScript code is executed. Otherwise,
we may get an error when we try to access an element that is not yet loaded. jQuery
provides us with a way to execute the code after the page is ready. It is the following code:

     // code here.

Actually, what we just used is the following codes:
     // code here.

The $ sign is a shortcut for jQuery. When we are calling $(something), we are actually
calling jQuery(something).

      $(function_callback) is another shortcut for the ready event.

It is identical to the following:


Also, identical to:


So, what will you use in your coding jQuery?