Get label of the plugin select2
Get label of the plugin select2
Hello Allan, how do I get the text of the plugin select2, because the plugin is sending only the value in order and need to capture the value of the label. How should I do? I tried to do this: "conf._input.text(val)" only it returns the entire list.
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
I don't know Select2 inside out I'm afraid - you might need to direct this question at their support channels, but try:
conf._input.find('option:selected').text()
.Allan
Perfect, Thanks very much!!!!!
Just came across this, looking for my use case. If you don't have direct access to conf, also try
where
this
is the editor instanceinst()
gets you access to the select2 component, then see https://select2.org/programmatic-control/retrieving-selections and note the cavaet.