alexis-magina / cmb2-field-post-search-ajax

CMB2 field type to attach posts to each others.
GNU General Public License v3.0
40 stars 18 forks source link

Conflict with jquery-ui autocomplete (eg. tags) #12

Closed 5ulo closed 7 years ago

5ulo commented 7 years ago

This custom field is using https://github.com/devbridge/jQuery-Autocomplete which is in conflict with jquery-ui available in WordPress. The documentation says we can use devbridgeAutocomplete() instead of autocomplete in order to prevent conflict. But the conflict is still preset.

If jquery.autocomplete.min.js is enqueued after jquery-ui-core it will work on cmb field, BUT the native wordpress tags (term autocomplete) in sidebar won't. There's an error in the console saying Uncaught SyntaxError: Unexpected token < in JSON at position 0

Any workaround?

5ulo commented 7 years ago

Heh.. got it working ! In jqury.autocomplete.min.js almost at the end find a.fn.autocomplete=a.fn.devbridgeAutocomplete=function(c,d){ and replace with a.fn.autocompleteX=a.fn.devbridgeAutocomplete=function(c,d){ I know this is not nice solution but works without any conflict.

alexis-magina commented 7 years ago

Thank you for your report, I don't use often tags in my WP websites so I didn't seen that. I tried with your suggestion and yes it works : I merged it in 1.1.3.

5ulo commented 7 years ago

check also my fork.. I made it to work with terms too