JqueryUi Dialog giving Uncaught TypeError: this._addClass is not a function error

Your JS looks to be written inline vs. in its own JS file or at least enqueued on its own. In other words, it doesn’t look like its being loaded properly re WordPress.

Note the WP function wp_enqueue_script() has a dependency parameter where you can pass an array of script handles (as registered via wp_register_script()). The parameters of this function helps you ensure that you load header + footer scripts in the desired location (header vs. footer) and desired order.

Docs:

https://developer.wordpress.org/reference/functions/wp_enqueue_script/
https://developer.wordpress.org/reference/functions/wp_register_script/

In the JS itself, make use of $( document ).ready():

http://learn.jquery.com/using-jquery-core/document-ready/

Your code is sitting in the markup before JQuery UI is loaded, which is a potential issue right there to resolve. If it was in its own file and properly enqueued in your theme’s functions.php (or by a site plugin) then it could specify JQuery UI’s handle as a dependency and WordPress will always load it after.

If you still have issues I would also disable your other plugins + any other bits of JS you’ve tossed in there (temporarily) to see if you can get this to work. If so, you could re-enable them one-by-one to identify the culprit.

It also looks like both Contact Form 7 and your theme/plugins are loading JQuery UI, and both depend on date pickers, etc. Contact Form 7’s core is loading before the JQuery UI (and loading its other JQuery UI dependencies after) but I don’t have enough experience with that plugin to know off-hand if that is a potential source of issues (it might also be something to look into).

Leave a Comment