select option value jquery code example

Example 1: how to get the selected text of dropdown in jquery

BY LOVE
$("#Id option:selected").text()

Example 2: select option value jquery

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

Example 3: jquery selected option

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

Example 4: jquery select option by value

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

Example 5: jquery option selected

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

Example 6: jquery selected option value

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