The two are exactly equivalent: use whichever form you like.
All three of the following syntaxes are equivalent:
$(document).ready(handler)
$().ready(handler) (this is not recommended)
$(handler)
This is the native way.
$(document).ready(function() {
// code
});
And this is a shorthand for the previous.
$(function() {
// code
}
);
Refer This Site For More Info
Jquery Official Site for More reference