Solved

Is it possible to avoid JQuery Clashes?

Posted on 2014-03-31
5
198 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
5 Comments
 
LVL 33

Assisted Solution

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

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

Expert Comment

by:Big Monty
ID: 39966729
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 31

Accepted Solution

by:
Marco Gasi earned 250 total points
ID: 39966723
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
ID: 39967939
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 31

Expert Comment

by:Marco Gasi
ID: 39968430
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

Optimize your web performance

What's in the eBook?
- Full list of reasons for poor performance
- Ultimate measures to speed things up
- Primary web monitoring types
- KPIs you should be monitoring in order to increase your ROI

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction A frequently used term in Object-Oriented design is "SOLID" which is a mnemonic acronym that covers five principles of OO design.  These principles do not stand alone; there is interplay among them.  And they are not laws, merely princ…
Styling your websites can become very complex. Here I'll show how SASS can help you better organize, maintain and reuse your CSS code.
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
Suggested Courses

626 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