“query function not defined for Select2 undefined error”

前端 未结 13 1579
名媛妹妹
名媛妹妹 2020-11-28 04:22

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

\"query function not defined for Select2 undefined error\"
13条回答
  •  一个人的身影
    2020-11-28 05:22

    In case you initialize an empty input do this:

    $(".yourelement").select2({
     data: {
      id: "",
      text: ""
     }
    });
    

    Read the first comment below, it explains why and when you should use the code in my answer.

提交回复
热议问题