Search code examples
jqueryjquery-select2jquery-select2-4

Select2 with multi select option only allows me to write 2 characters


I'm using select2 v4.0.7 and setting up a multi select with the option to dynamically create tags like so:

<select id="role-select" class="form-control" multiple="multiple">
   <option value="1">Admin</option>
</select>

and I initialize the select2 like so:

$('#role-select').select2({
    tags: true
});

All this is set up in a Laravel 5.8 environment and I'm using CDNs for select2.

The problem is that when I try to write in the select option I can't type more than 2 characters.

Is there something I'm doing wrong o not doing?

Update

Has anyone been able to reproduce this error???

Extra information: Webserver is an ubuntu 16.04 box using apache2


Solution

  • select2 v4.0.7 and jQuery 3.4.1 are incompatible. If you use jQuery ~3.3.1 then it works.

    See also https://github.com/select2/select2/issues/5485