Using Select2 get error - "Error: No select2/compat/query"
I've had this when you have two controls on your web page with the same Id - I had a hidden control and a select (the hidden control was first).
For me, changing the <input />
tag to a <select>
tag worked.
You are running into two issues here, both of which can easily be fixed.
Select2 4.0.0 no longer supports the
query
option in the slimmed down, standard build. This must be included in the full build (select2.full.js
) as it is handled through a backwards compatibility module.You are using Placecomplete and it depends on an older version of Select2. It looks like Select2 3.5.2+ can work, but I can tell from the options that it is using, it cannot work with Select2 4.0.0. There is an open ticket about this for Placecomplete.