- How to get selected option text value in JavaScript?
- How do I get the text value of a selected option?
How to get selected option text value in JavaScript?
Use the selectedIndex Property
We can get the index of the selected item with the selectedIndex property. Then we can use the text property to get the text of the selected item. We create the getSelectedText function that takes an element as the parameter. Then we check if selectedIndex is -1.
How do I get the text value of a selected option?
find(":selected"). text(); it returns the text of the selected option.