PDA

View Full Version : jscript version question



ERISCO
11-27-2014, 04:55 PM
First, I apologize if this question seems naīve. It's my first post and I'm pretty new at this stuff :)

I use a number of scripts that call different versions of jquery.min.js
Some are from http://ajax.googleapis.com/ajax/libs/jquery/1.8/
and some are from https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js

My question is, does it matter what version I use? Can I just load the latest version and expect the code to work in other scripts?

jscheuer1
11-27-2014, 05:46 PM
No, you can't just expect it to work. But it might. If the code works with 1.7.2 and 1.8 - it will almost certainly work with only 1.8. But there could be other issues than just working with the particular jQuery version. Some scripts that use jQuery put it into noConflict mode. If one or more of the scripts does this and one or more of them aren't written to operate in this manner, just that can cause a problem (usually easy to fix by removing all calls to jQuery.noConflict() which will work as long as you don't also use other libraries like Prototype/Scriptaculous or MooTools).

You might also be able to do what you propose (just use the latest version of jQuery). But be aware that 2.x no longer supports IE 8 and less, and might not work with scripts written for earlier versions of jQuery. Version 1.11.x is the latest jQuery I know of (1.12.x will probably be out soon if it isn't already) that supports IE 8 and less, but still might have problems with code written for earlier versions of jQuery.

Scripts usually work best with the jQuery version they were written to work with, but often will work with almost any version, and if not, often with versions close to the one they were written for. Scripts can often be easily updated to a later jQuery version if you know jQuery and/or javascript well.

There's a good chance that just using 1.8 will work for you, even perhaps just using 1.11. And it is a good idea to use just one version of jQuery if you can.

If you want more help though, please post a link to the problematic page on the live web so we can take a look at it.

Beverleyh
11-27-2014, 05:49 PM
To add to John's answer, this jQuery blog post might be of interest to you too http://blog.jquery.com/2014/10/29/jquery-3-0-the-next-generations/

ERISCO
12-01-2014, 01:43 PM
Thanks very much John. That's a long explanation for something that I thought might be a simple yes or no! I should know better :). Currently, I'm having issues with cross browser functionality but I think it's in my page rather than which library I'm using. If I can't resolve it, I'll be sure to drop you a line with a link to the page. I normally do all my developing locally prior to uploading but I have a ton of room on my hosting server so we'll see. More will be revealed!
-Robb

ERISCO
12-01-2014, 01:44 PM
Thanks Beverley. That article was very interesting, even for a newbie like myself.
- Robb