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