select onchange jquery get the selected option data attribute
snippet in javascript

select onchange jquery get the selected option data attribute

user2653

$('#country').on('change', function(){
    let id = $(this).find(':selected').data('id');
    console.log(id);
  });

jquery get data attribute of selected option

user8185

$(this).find(':selected').data('id')