select onchange get data attribute of option code example
Example: select onchange jquery get the selected option data attribute
$('#country').on('change', function(){
let id = $(this).find(':selected').data('id');
console.log(id);
});
$('#country').on('change', function(){
let id = $(this).find(':selected').data('id');
console.log(id);
});