jquery select change get option data 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);
});