Why write code Jquery like this?
(function ($) {
$(function () {
.......
});
})(jQuery);
(function ($) {
//
})(jQuery);
This type of Module pattern is very used out there. It invokes itself passing a reference to jQuery providing faster access to the variable, as it now lives in the scope of the function, and it also prevents global pollution.
The second one:
$(function () {
.......
});
Runs the anonymous function once the DOM is loaded, that you make sure that everything is ready before executing any code.