6

Just wondering if there's any tutorials or ways to update jQuery scripts and functions.

I have version 1.4 and version 1.6.2 running, and I want to update both of them to 1.7.1 but I need to modify my script. I have no clue where to begin and what to change. Where can I start?

6
  • 1
    The easiest thing to do is just try upgrading and see what breaks. Have Firebug open and when an error occurs, check what line it is and see what changed with that specific function call between 1.4 and 1.7 Commented Feb 5, 2012 at 18:38
  • In my opinion is jQuery backwards comptable, which means that if the code run well in 1.4 it also will run well in 1.7.1.
    – Wouter J
    Commented Feb 5, 2012 at 18:43
  • @WouterJ it didnt though. Heres my site as of now. If i change it to 1.7.1 it won't work envycosmetics.zxq.net/Website/webpages/index.html Commented Feb 5, 2012 at 18:47
  • @WouterJ: jQuery sometimes makes changes that breaks code. Whether it's a common non-supported use of the API that is now enforced, or a direct change in how something previously worked.
    – user1106925
    Commented Feb 5, 2012 at 18:49
  • @user1165861: You'll seen an Error message in the console that states Uncaught TypeError: Object #<Object> has no method 'bjqs'. Seems to do with the slider plugin. That would be a place to start looking. Maybe they have an updated version of the plugin.
    – user1106925
    Commented Feb 5, 2012 at 18:50

2 Answers 2

5

The place to begin would be to read the release notes of each jQuery update.

Here's the link for 1.7 API changes. That page also includes a link to the change log.

Do this for each version you need, starting with the earliest. This will let you know not only of potential breaking changes, but also of new features that are available to you.

For the different versions, see the menu on the left from the first link I provided...

enter image description here


EDIT:

Since from the link provided in a comment, there seems to be an issue with a plugin, you'll want to check the sites of all your plugins to make sure that you're using the latest version.


Direct cause of the issue

It seems that the direct issue you're having is that you're loading jQuery more than once, and demolishing the basic-jquery-slider.js plugin with the second load.

<!--loading jQuery-->
<script src="../js/jquery-1.6.2.min.js"></script>

<!--loading the slider plugin-->
<script src="../js/basic-jquery-slider.js"></script>

<!--loading jQuery again, which is overwriting 
                      the original jQuery and its plugin-->
<script type='text/javascript' src='http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js'></script>
<script type='text/javascript' src='../js/jquery.ba-hashchange.min.js'></script>
<script type='text/javascript' src='../js/dynamicpage.js'></script>

You should load only one version, and load it before any plugins are loaded.

2

Just update the library and test your site in all the browsers. There is no other way than testing cross browser functionalities.

After that you can think of using the latest changes jQuery has reelased may be for bug fixing or performance improvement. It depends on you whether to go for it or not based on the kind of application you have.

Not the answer you're looking for? Browse other questions tagged or ask your own question.