I am trying to learn more about how the
jquery.validate.unobtrusive.js
file works.
I am confused by the opening syntax which I have abbreviated below...
(function ($) {
var $jQval = $.validator,
adapters,
data_validation = "unobtrusiveValidation";
function setValidationValues(options, ruleName, value) {
options.rules[ruleName] = value;
if (options.message) {
options.messages[ruleName] = options.message;
}
}
... more stuff (deleted)
}(jQuery));
Questions
Thanks for any insight!
Ok, I have found the answer to this while reading about authoring jQuery plugins.
http://docs.jquery.com/Plugins/Authoring
The $ passed to the function is jQuery itself being passed to a function so that namespace collisions won't occur (which mostly answers my questions 1-3).