dropdown list. Keeping in mind what we stated above, we know that we can recover the index, the value or text. This index starts from 0 and returns -1 if no option is selected. The index found before it can be used with this property to get the selected element. The second one is the text value of the select element. Javascript Select options. Note: If the drop-down list allows multiple selections it will only return the index of the first option selected. In the example code, we will show how you can get the text value of the select using jQuery. Now, we need to select the above elements by data attribute in JavaScript. - JavaScript - Get selected value from dropdown list. Full Source. The following program shows how to get selected index value or selected text from a Javascript dropdownlist. Hold down the control key on Windows or command key on Mac to select multiple options. Extract Data from an External JSON File and Bind Data to Element. Get Selected Options from Multiple Select Box. Selecting the Single element. Get the selected value of dropdown list using JavaScript. Get The Data-Id By The Option Value. The following select box has some options with values, the text value of the selected option will be retrieved from this select element. text: It gives the text inside the option; selected: It tells whether the option is selected or not; Setting Value of Select Element. Similarly, you can retrieve the selected values from multiple select boxes with a little trick. Note: If no option is selected, the selectedIndex property will return -1. The elements are sorted according to the source code of the page. A String, representing the value of the value attribute of an