javascript - weird jQuery JSON function... whats going on here? -


Browse float examples here

(see source once there)

I came to:

  & lt; Script id = "source" language = "javascript" type = "text / javascript" & gt; $ (Function () {var datasets = {"usa": {...  

$ (function () part. I think this is an anonymous function, why do not I do it It would be as good to use it:

  & lt; script id = "source" language = "javascript" type = "text / javascript"> var dataset = {"usa": {...  

I checked on jQuery Docs (http://api.jquery.com/) and found no special use for the function ()

  $ (function () {  

DOM is ready to confirm, this is a document. Handler in jQuery, already has the same effect:

  $ (document) .ready (function () {< / Code> 

You want to run some code on document.ready so that the element exists there, for example if you type $ (".class") Using the as a selector, you do not want to run that code unless the DOM loads completely, so for the element that you are looking for, f Ready to be available by Nkrta ... means that your code will always work, even if it's & lt; Head & gt; In

For documentation, look in the API.


Comments