Answer the question
In order to leave comments, you need to log in
How to resolve jquery plugin conflict?
I inherited a project, it has 3 js files connected:
1) jquery
2) user code
3) libs.js file. It contains plugins for jquery. That is, the author took, minified and stuffed a pack of plugins into one file. And, it seems, he also added his own code there. Probably, from the point of view of process optimization, it is correct, only now you will understand what plugins and what version the project has. At most, you can deminify everything, but it doesn’t get much easier.
And I needed to connect jquery.validation to one page. As luck would have it, one of the plugins put into this file does not allow jquery.validation to work correctly (it says that the valid () method was not found), if libs.js is disabled, then everything is fine, but, of course, you cannot disable it , because a lot of things rest on it.
Here wanted to consult as it is better to dig. Trying to figure out this wonderful libs.js file or is there a way, something like taking a copy of jquery and jquery.validation and taking it out, say, in a separate namespace or somehow separate so that jquery.validation and access to it are independent of all other code. I looked in the direction of jquery.noconflict, but did not really understand how this could help here.
Answer the question
In order to leave comments, you need to log in
first check the version of jquery that you have and which is required for validation
if there is no version conflict, then the rest is only handles - breakpoint and debug, you can still format the minified file and put this lib in order
if you take something out into a separate namespace, then and the code must be written in accordance with this namespace
about jquery.noconflict read the documentation in case there are conflicts in the code that this function solves
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question