select2 get value code example
Example 1: get select2 selected value
//initialize
$('#mySelect2').select2('data');
//get selected value
$('#mySelect2').find(':selected');
Example 2: select2 get data attribute value
$('#mySelect2').on('select2:select', function (e) {
var data = e.params.data;
console.log(data);
});
Example 3: select2 get data attribute value
$('#payment_method').select2('data')[0]