• Resolved KZeni

    (@kzeni)


    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.

Viewing 5 replies - 1 through 5 (of 5 total)
  • Thanks @kzeni! I will update this here again soon. I missed this as a deprecated function.

    Thanks, Rob

    Hi @kzeni! I updated to fix this issue. Thanks!

    Thread Starter KZeni

    (@kzeni)

    Thanks for the fast fix!

    We have the same issue and we just upgraded our site – we have the latest version of WP and the latest version of this plugin. Can you check it again with the WP version 4.8.2 that was just released? We had to deactivate your plugin because it broke our site.

    Thread Starter KZeni

    (@kzeni)

    I just grabbed a download of the plugin’s current version (5.0.33) direct from https://www.ads-software.com/plugins/google-language-translator/, and a search through all of the plugin’s files shows that there are 0 instances of .live being used as they’ve all been switched to .on.

    I’m not sure what the problem you’re having with the plugin, @ajumbra, but maybe you should start a new support topic as the issue being discussed in this topic has verifiably been resolved.

    • This reply was modified 7 years, 2 months ago by KZeni.
Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Fatal JavaScript error from using .live() function removed in jQuery 1.9 w/ fix’ is closed to new replies.