difference between Immediately-Invoked Function and jQuery Immediately-Invoked Function

javascript, jquery

Solution

$(function(){}); 

isn't immediately called : it is called when the DOM is ready. It's a shortcut for

$(document).ready(function(){}); 

See documentation

Problem

i have read that `(function(){})();` is called immediately and doesn't need to be called. and `$(function());` is also immediately called. - are they both and have same functionality ? - does the Immediately-Invoked Function loaded after the document is completely loaded ? - what is the actual functionality of `$(function());` ? - does `$(function());` after the document is completely loaded ?

Original source

Related problems