Different ways to get selected text from drop-down list:
<script>
$(document).ready(function()
{
$("#cars").change(function(){
alert($("#cars option:selected").text());
alert($("#cars :selected").text());
alert($("#cars").children(":selected").text());
alert($("#cars").find(":selected").text());
});
});
</script>
Working Example
<!DOCTYPE html>
<html lang="en">
<head>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.js"></script>
<script>
$(document).ready(function()
{
$("#cars").change(function(){
alert($("#cars option:selected").text());
alert($("#cars :selected").text());
alert($("#cars").children(":selected").text());
alert($("#cars").find(":selected").text());
});
});
</script>
</head>
<body>
<select name="cars" id="cars">
<option value="volvo">Volvo</option>
<option value="saab">Saab</option>
<option value="fiat">Fiat</option>
<option value="audi">Audi</option>
</select>
</body>
</html>
Most Helpful This Week
Edit the text of label on click using jQuery
How to join string with number in JavaScript?
How to scroll page to 1000px from top on page load using jQuery?
How to declare and print value of variable in JavaScript?
How to current URL, HOST and URL attributes using JavaScript or jQuery?
Get largest number from each sub-arrays