It is short form of document.ready event. It is executed when DOM is ready.
All three of the following syntaxes are equivalent:
- $( document ).ready( handler )
- $().ready( handler ) (this is not recommended)
- $( handler )
The handler passed to .ready() is guaranteed to be executed after the
DOM is ready, so this is usually the best place to attach all other
event handlers and run other jQuery code. When using scripts that rely
on the value of CSS style properties, it's important to reference
external stylesheets or embed style elements before referencing the
scripts, jQuery api.