Fatal JavaScript error from using .live() function removed in jQuery 1.9 w/ fix
-
I updated my site to v5.0.32 of Google Language Translator and found that all of my site’s JavaScript stopped working. I then found a fatal JavaScript error relating to this plugin that’s in the footer. The fatal issue was the fact that the script was using the .live() jQuery function that was deprecated in jQuery 1.7 and removed in jQuery 1.9. I’m now using jQuery 1.12.4 on my site so this was a very serious issue.
The fix was to edit the
wp-content/plugins/google-language-translator/google-language-translator.php
file so that$("a.flag").live("click"
is instead set to
$("a.flag").on("click"
currently on
line 350
of that file. This should be supported by any site with jQuery 1.7 or newer (which was released nearly 6 years ago, now).Please update this in the next version so that those using a version of jQuery that isn’t over half a decade old don’t have the JavaScript on their site break. Also, you might be able to still check for the existence of the .on function if you still want to support jQuery versions older than 1.7.
- The topic ‘Fatal JavaScript error from using .live() function removed in jQuery 1.9 w/ fix’ is closed to new replies.