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

前端 未结 9 1255
心在旅途
心在旅途 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条回答
  •  谎友^
    谎友^ (楼主)
    2020-12-12 23:59

    Used this for show text

    var data = $('#id-selected-input').select2('data'); 
    data.forEach(function (item) { 
        alert(item.text); 
    })
    

提交回复
热议问题