Rajnish
Rajnish

Reputation: 94

jquery.js and jquery.min.js is conflict to each other

How to solve two jquery conflict in my html file, I have pasted the code below:

<script type="text/javascript" src="js/jquery.js"></script>    
<!--Navigation Scripts-->    

<!--Image Slider Scripts-->    
<script src="js/jquery.min.js"></script>    

If I remove any one of them (script) then it will be work fine but one of these does not working, else whether it be anyone.

Upper one jquery.js is for navigation bar and another one jquery.min.js is for sliding banner script.

Upvotes: 2

Views: 10857

Answers (3)

PMG
PMG

Reputation: 190

You don't need both. Just pick one, preferably the latest version.

Upvotes: 1

Allan Chua
Allan Chua

Reputation: 10175

Just remove both of them and add the code below:

<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>

it will solve your problem. I assume that the both of them are jQuery scripts and not your own javascript file. jQuery.min.js is much better because it loads faster from the web server due to it's minification.

NOTE Using the jquery.min.js script hosted by google will make your site load faster because this script might be already on the clients computer because the user might have already navigated to a site that cached the same script.

Upvotes: 1

dachi
dachi

Reputation: 1602

Normally you include only one jQuery library into your application. You probably have a problem with versioning, I mean your navigation bar and sliding banner script use different versions of jQuery. What you should do is visit vendor websites and look at their versions, then accordingly pick one version of jQuery library that will suit both of your vendor libraries.

You can see avalaible jQuery versions here http://code.jquery.com/jquery/

When you pick a correct version, use minified version for performance.

Upvotes: 4

Related Questions