jquery this selected option 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: selected option attribute jquery

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

Example 4: get selected option value jquery

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

Example 5: get selected option jquery

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

Example 6: $(this) option selected jquery

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

Tags:

Misc Example