jQuery - Document Ready

The DOM needs to fully load into the browser or you will get errors if you try to execute jQuery code against it before it fully loads. Overcoming this is easy as you can use the ready function.


$(document).ready(function()
{
    // js code here..
});

In jQuery, the shortcut for (document).ready is simply $(function(){ ...code... });. For example:


$(function()
{
    //..stuff..
});

Also, In JQuery, the $ simply means “find” or “get” ...as in get this element/tag.