select option attr jquery code example

Example 1: select option value jquery

$("select.country").change(function(){
  var selectedCountry = $(this).children("option:selected").val();
  alert("You have selected the country - " + selectedCountry);
});

Example 2: selected option attribute jquery

$('#location').find('option:selected').attr('myTag');

Example 3: jquery select option by value

$('.selDiv option[value="SEL1"]')

Example 4: $(this) option selected jquery

var cur_value = $('option:selected',this).text();