How to get Selected Text from select2 when using <input>

前端 未结 9 1223
心在旅途
心在旅途 2020-12-12 23:38

I am using the select2 control, loading data via ajax. This requires the use of the tag.

Now, I want to retrieve the selecte

9条回答
  •  -上瘾入骨i
    2020-12-13 00:15

    This one is working fine using V 4.0.3

    var vv = $('.mySelect2');     
    var label = $(vv).children("option[value='"+$(vv).select2("val")+"']").first().html();
    console.log(label); 
    

提交回复
热议问题