How to set a Specific option as selected

<html>
<head>
	<script src="jquery-2.1.0.min.js" type="text/javascript"></script>
	<script>
	 $('document').ready(function(){
	   $('#btnSubmit').click(function(){
            alert($('#cboLocation').val());
            alert($('#cboLocation').find(":selected").text());
			});
		});
	</script>
</head>
<body>
<select name="cboLocation"  id="cboLocation">
  <option value="">Select Zone</option>
  <option value="South">South Chennai</option>
  <option value="North">North Chennai</option>
  <option value="East">East Chennai</option>
  <option value="West">West Chennai</option>
</select>
<input type="button" name="btnSubmit" id="btnSubmit" value="Click Me"/>
</body>
</html>

How to get Selected Item Value

 alert($('#cboLocation').val());

How to get Selected Item Text

 alert($('#cboLocation').find(":selected").text());

Comments are closed.