Fixing broken plugin to use jQuery .on() instead of .live()


Updated site to latest WordPress version (5.5.1) and unfortunately a plugin broke.

I found the SO ( helpful and I know what needs to be done but I don’t know how to apply it to the existing syntax. This is a WordPress plugin ( that isn’t being supported by the developer any more (couple of years now). I’d like to try and update the plugin to work with WordPress 5.5.1 instead of having to find a new plugin and update every page that used the old plugin.

The existing code is

$netgo_navigations.find("ul li").live("click", function(e) { 

and I believe I need to provide a static parent (which I have) but I don’t know how to apply it to the current syntax as shown above. My assumption was I could simply change .live to .on and it would be fixed since I thought the .find() would provide the ‘static’ parent but that doesn’t seem to be the case.

$netgo_navigations.find("ul li").on("click", function(e) { 

What else do I need to do?

HPWD 4 months 0 Answers 18 views 0

Leave an answer