Can someone explain me the syntax below line 1? I am OK with js and function references, but this code looks a bit confusing. E.g. is it function declaration and execution?
jQuery.noConflict();
(function($) {
$(function() {
// more code using $ as alias to jQuery
});
})(jQuery);
// other code using $ as an alias to the other library
asked Nov 2, 2009 at 12:48
AlexA
4,1188 gold badges54 silver badges85 bronze badges
1 Answer 1
Exactly.
You create an anonymous function which takes one parameter, and immediately invoke it with the parameter jQuery.
answered Nov 2, 2009 at 12:50
Kobi
139k41 gold badges259 silver badges302 bronze badges
Sign up to request clarification or add additional context in comments.
1 Comment
AlexA
Thanks for clarification. For some reason declaration and execution in my mind counln't co-exist.
lang-js