select option with 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: jquery selected option

$( "#myselect option:selected" ).val();

Example 3: jquery select option by value

$('.id_100 option[value=val2]').attr('selected','selected');

Example 4: jquery option selected

$('.selDiv option:eq(1)').prop('selected', true)

Example 5: jquery select option by value

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

Example 6: $(this) option selected jquery

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

Tags:

Misc Example