What is the difference between these jQuery ready functions?

后端 未结 9 1430
名媛妹妹
名媛妹妹 2020-11-22 15:31

what is difference between

$(function(){

}); 

and

$(document).ready(function() { 

});
9条回答
  •  感情败类
    2020-11-22 16:07

    Nothing whatsoever.

    This function behaves just like $(document).ready(), in that it should be used to wrap other $()

    You can see this in the source code:

    rootjQuery = jQuery(document);
    
    ...
    
    } else if ( jQuery.isFunction( selector ) ) {
        return rootjQuery.ready( selector );
    }
    

提交回复
热议问题