1

I have a function:

var waitingDialog = (function($){
.....
return{
}
})(jQuery);

Also could you explain what $ means in the function? Is it going to work without that?

Lyubomir Velchev
  • 962
  • 2
  • 11
  • 30

2 Answers2

2

It means that jQuery (if it exists) will be passed to the function. $ is merely the name that variable will take in the scope of the function.

Phil Cooper
  • 2,972
  • 38
  • 61
2

There is a section about that in official jQuery website : https://learn.jquery.com/plugins/basic-plugin-creation/#protecting-the-alias-and-adding-scope

jmgross
  • 2,256
  • 1
  • 19
  • 21