In this article, we are going to learn how to get the selected option text and value in JQuery.
Let's say we have the following select dropdown html code.
<select id="cboFruit" class="comboBox"> <option value="">Select Fruit</option> <option value="Apple">Apple</option> <option value="Banana">Banana</option> <option value="Blueberry">Blueberry</option> <option value="Melon">Melon</option> <option value="Watermelon">Watermelon</option> </select>
To get the selected text, we can use the following JQuery code. The hashtag # represents the selector id of select HTML object.
$("#cboFruit option:selected").text();
To get the selected value, we can use the built in val method.
$("#cboFruit").val();
Demo
You can see the following real demo by clicking the Get Value button to get the select option value or click the Get Text button to get selected option text value.