what is difference between
$(function(){ });
and
$(document).ready(function() { });
They're effectively the same. No difference.
This is the native way.
$(document).ready(function() { // code });
And this is a shorthand for the previous.
$(function() { // code });
jQuery source code