Solved

Is it possible to avoid JQuery Clashes?

Posted on 2014-03-31
5
180 Views
Last Modified: 2014-03-31
Over time I have accumulated a number of collections of JQuery code to do all manner of things.

I have discovered that some of the JQuery interferes with other JQuery and results in one of the JQuery Objects/Libraries not working.

Is there a way to avoid this?
0
Comment
Question by:AIGS
  • 2
  • 2
5 Comments
 
LVL 32

Assisted Solution

by:Big Monty
Big Monty earned 250 total points
Comment Utility
I suggest looking into jQuery's noConflict mode:

https://api.jquery.com/jQuery.noConflict/
0
 
LVL 32

Expert Comment

by:Big Monty
Comment Utility
it is also used for multiple versions of jquery:

If for some reason two versions of jQuery are loaded (which is not recommended), calling $.noConflict( true ) from the second version will return the globally scoped jQuery variables to those of the first version.

taken directly from the 2nd paragraph of the page I linked to.
0
 
LVL 30

Accepted Solution

by:
Marco Gasi earned 250 total points
Comment Utility
jQuery,noConflict refers to conflict between jQuery and other javascript framwork, such as Prototype or MooTools.

I used jQuery.Migrate.js to solve problems deriving me from code written using different versions of jQuery, so I think you could try to download it and include it in each page where you use your scripts: maybe it can help you to avoid problems (but I'm not sure about).
0
 

Author Closing Comment

by:AIGS
Comment Utility
Thanks for your help, I was able to use JQuery noConflict, and found that the placement of it was important to ensure it worked.

Thanks.
0
 
LVL 30

Expert Comment

by:Marco Gasi
Comment Utility
I''m glad you solved your problem, but can you explain the reason of the downgrade?
You can read here the guidelines of answers' grading: http://support.experts-exchange.com/customer/portal/articles/481419.

As you can rad there, the default grade is excellent and you must have good reasons to downgrade a solution: for instance, if experts solutions solve your problem but they are not the solution you expected, this is not a valid reason to downgrade their help.
In other words, when you downgrade an answer, you're saying that expert has done a bad job, its solution is deficient and h could had done more to help you. If all this is not tru, it sounds rather offensive for someone who tried to help you, isn'it?

So, please, if you have a valid reason to downgrade our answers, explain them here, otherwise request attention to a moderator using the link below your question box and ask him to change the grade.

Cheers
Marco
0

Featured Post

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

What is Node.js? Node.js is a server side scripting language much like PHP or ASP but is used to implement the complete package of HTTP webserver and application framework. The difference is that Node.js’s execution engine is asynchronous and event…
It’s a strangely common occurrence that when you send someone their login details for a system, they can’t get in. This article will help you understand why it happens, and what you can do about it.
The viewer will receive an overview of the basics of CSS showing inline styles. In the head tags set up your style tags: (CODE) Reference the nav tag and set your properties.: (CODE) Set the reference for the UL element and styles for it to ensu…
Use Wufoo, an online form creation tool, to make powerful forms. Learn how to choose which pages of your form are visible to your users based on their inputs. The page rules feature provides you with an opportunity to create if:then statements for y…

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now