Select Page

Uncaught TypeError: jQuery(…).tooltip is not a function problem in WordPress plugins

I was developing a plugin and I hit a problem: Gravity Forms was causing my plugin and all Javascript on the site to fail. I was pulling my hair out. It turns out I’m not alone:

https://wordpress.org/support/topic/uncaught-typeerror-jquery-tooltip-is-not-a-function-2/

What was going on?
Gravity Forms needed JQuery UI. My plugin needed JQuery. My plugin was jumping the gun and loading its prerequisite plugins. When I called for includes, I only needed JQuery. Gravity Forms was loading its tooltip() functionality before I was loading JQuery. My call didn’t need JQuery UI, so that caused my script to fail. The call for the JQuery UI isn’t a killer hit.

In my WordPress plugin development, I took one of the enqueue scripts and changed it –

wp_enqueue_script("tabular-vendor", plugin_dir_url( __FILE__ )."../public/js/vendor.js", array('jquery'), TRUE);

to

wp_enqueue_script("tabular-vendor", plugin_dir_url( __FILE__ )."../public/js/vendor.js", array('jquery', 'jquery-ui'), TRUE);

adding in the jquery-ui to my calls it satisfied Gravity Forms and allowd all of the scripts on the page to keep running.