Online Snippets Library

Get Selected Value of Dropdown in jQuery

To get selected value of dropdown,we use val() function of jQuery.

Example

HTML
<!DOCTYPE html>
<html>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"> </script>
<title>Get Selected Value of Dropdown in jQuery </title>
</head>
<body>
<select id="select">
  <option value="1">Text 1</option>
  <option value="2">Text 2</option>
</select>
<input id="button" type="button" value="Get Value" />
</body>
</html>
Javascript
$(document).ready(function(){
  $("#button").click(function(){
     alert($('#select').val());//id of dropdown
  }); 
});