jquery select dropdown 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 dropdown select

$('select>option:eq(3)').prop('selected', true);

Example 4: jquery select dropdown

$('#mySelectElement option')[0].selected = true;

Example 5: jquery dropdown select

$("#element-id").val('the value of the option');

Tags:

Misc Example