I am using the select2 control, loading data via ajax. This requires the use of the <input type=hidden..>
tag.
Now, I want to retrieve the selected text. (The value
property in the data-bind
expression sotres the id
only)
I have tried $(".select2-chosen").text()
, but this breaks when I have multiple select2 controls on the page.
Also you can have the selected value using following code: