javascriptruntime-errorjquery-select2

"query function not defined for Select2 undefined error"


Trying to use Select2 and getting this error on multiple item input/text field:

"query function not defined for Select2 undefined error"

Solution

  • Covered in this google group thread

    The problem was because of the extra div that was being added by the select2. Select2 had added new div with class "select2-container form-select" to wrap the select created. So the next time i loaded the function, the error was being thrown as select2 was being attached to the div element. I changed my selector...

    Prefix select2 css identifier with specific tag name "select":

    $('select.form-select').select2();