Get selected value of a dropdown item using jQuery

Get selected value of a dropdown item using jQuery

$(document).ready(function(){ 
  $('#btn_Submit').click(function(){ 
    alert($('#combo :selected').text());
  });
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<select id="combo">
  <option value="1">A</option>
  <option value="2">B</option>
</select>
<input id="btn_Submit" type="button" value="Click!" />

You can use the jQuery :selected selector in combination with the val() method to find the selected option value in a select box or dropdown list

2020-02-25