3
I’m writing a plugin for tables called easyTable.
After understanding the basic workings of a plugin and how it can perform a chaining li in the documentation that to avoid conflict it should look like this:
(function ( $ ) {
$.fn.easyTable = function() {
// methods...
return this;
};
}( jQuery ));
I would like to understand why the plugin should be within this function,so it seems this makes it anonymous.
Documentation: How to Create a Basic Plugin
It seems to me that you are confusing what happens, this template will not prevent conflicts in your plugin, IE, if there is another plugin jquery called
easyTable
will still conflict. What the model prevents is the conflict between jQuery lib and another lib that uses$
(and it is still necessary that you invokenoConflict
), the response of bfavaretto explains how this works.– BrunoRB