Now I am writing my first jQuery plugin, and I found this blog post about "Created the first jQuery plugin" , but in the first step they give two ways to write the plugin: First:
$.fn.yourPlugin = function(options) {
return this.each(function() {
});
};
And the second one:
(function($){
$.fn.yourPlugin = function() {
return this.each(function() {
});
};
})(jQuery);
Because they say that there may be problems with $conflicts similar to other libraries ....
So, I would like to know what is the best practice here.
source
share