Que: How to get the value and label of option from select2 using jQuery?
Ans:
var theID = jQuery("#tags").select2('data').id;
var theSelection = jQuery("#tags").select2('data').text;
Here #tags is the id of your select2 field in html code.
Ans:
var theID = jQuery("#tags").select2('data').id;
var theSelection = jQuery("#tags").select2('data').text;
Here #tags is the id of your select2 field in html code.
No comments:
Post a Comment