Web development Birmingham

jQuery 1.9 breaks code

jQuery have broken a lot of things (with good reason) in jQuery 1.9.x. Now, though it is great to keep up-to-date and have a lean jQuery code base this isn't so great if it means you need to go through and rework all of your code.

Quickly fixing jQuery 1.9.x problems

The easiest and quickest way to fix issues introduced in jQuery 1.9.x is to include their migration script into the top of your pages. This script aims to make depricated functions work again and tell you what you need to rewrite.

Long term fix

The best solution is going to be to rewrite your code to work with the jQuery code base. Fortunately jQuery have written an upgrade guide which clearly documents what functions and changes they have made with this latest release.

TL;DR?

The problem with the above is that the jQuery migration guide is really lengthy. We have found that the most common issue with migration (and that doesn't flag up with a migration error!) is that the .attr() function is no longer supported.

So, have a go at find/replacing .attr( with .prop( , we have found that this will fix 98% of the scripts that have broken as a result of the new changes.

Did you find this article useful? Sharing is a great way to show support, and ensures that we can continue to create more quality articles:

Get a free quote