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.
If the value for an option is not defined specifically, the text content of the <option> element will be used as a value instead, as shown in the following code:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>jQuery Get Selected Option Text</title>
<script src="https://code.jquery.com/jquery-1.12.4.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$("select.country").change(function(){
var selectedCountry = $(this).children("option:selected").val();
alert("You have selected the country - " + selectedCountry);
});
});
</script>
</head>
<body>
<form>
<label>Select Country:</label>
<select class="country">
<option>United States</option>
<option>India</option>
<option>United Kingdom</option>
</select>
</form>
</body>
</html>
Alternatively, you can use the jQuery text() method to get the text content of an element.