yanickrochon / jquery.uix.multiselect

Completely rewritten, multiselect widget with a more concise API
http://mind2soft.com/labs/jquery/multiselect/
MIT License
139 stars 62 forks source link

Wordpress implementation gives error .button is not a function #110

Open steeevio opened 6 years ago

steeevio commented 6 years ago

I've been trying to switch to this from version 1 which has been working great for me, but on upgrading to this version I get an error "Uncaught TypeError: $(...).addClass(...).attr(...).attr(...).button is not a function" That suggests to me it's a jquery ui issue but as far as I can tell jquery and jquery ui are both loading correctly

zodit commented 2 years ago

This happens because WordPress is loading Jquery-ui partially.

If you are in the backend you should have already the core library, but if you are in frontend you should load this:

wp_enqueue_script('jquery-ui-core');

But this is not enough, in this case mutliselect wants also "button", then you add this:

wp_enqueue_script('jquery-ui-button');

Now multiselect should work.