Reputation: 33
Is it possible to have multiple jquery plugins in one file under (function( $ )
If it is possible then I have a really wierd issue. There are two plugins in my single file both sitting in the following structure:
jQuery(document).ready(function() {
(function( $ ){
//PLUGINS HERE
})( jQuery );
});
Both are using the standard pattern of declaring the variable $this as a varablie within a .each iteration returning the main function of each plugin.
However, what is happening is that the plugin declared last is taking the $this variable from the the first pugin, even although the $this variable is declared within the .each function. I thought javascript had function scop level so this should be possible.
EDIT:
Solved this. This was the issue incase anyone else has the same issue in future:
How to isolate functionalities between multiple jQuery Plugins in Same Page
Upvotes: 3
Views: 1991
Reputation: 6466
Yes, you can declare as many extensions as you want. For want purpose, if you don't mind me asking?
Upvotes: 1