How do I get the selected value from a dropdown list using JavaScript? Parent based Selectable Entries Condition. OP said that didn't work for them: "I tried the methods below but they all return the selected index instead of the value: Great answer, thank you! difference is that the onchange event also works on in javascript, How can I Fetch data after selecting from dropdown list, Use Ajax to Update database with Select option instead of form with button, Using a javascript select dropdown. change the select option using jquery. Example: This example shows the use of the above-explained approach. I think this is the actual answer most people are looking for. rev2023.3.1.43269. Get selected text from a drop-down list (select box) using jQuery. By clicking Accept all cookies, you agree Stack Exchange can store cookies on your device and disclose information in accordance with our Cookie Policy. Launching the CI/CD and R Collectives and community editing features for Get Selected value from dropdown using JavaScript, JavaScript Alert Selected Option of html drop down, Get the option value in select in javascript. To fix use, Or you can use simple Javascript like this-, jQuery get value of select html elements using on Change event. Simply go through the event object in your function onChange, see example bellow, function test() { Browse other questions tagged, Where developers & technologists share private knowledge with coworkers, Reach developers & technologists worldwide. var select = document.getElementById('language'); var value = select.options[select.selectedIndex].value; console.log(value); // en Why does Jesus turn to the Father to forgive in Luke 23:34? I am using event "live", my solution is basically similiar with Dimitiar, but instead of using "focus", my previous value is stored when "click" is triggered. Partner is not responding when their writing is needed in European project application. When there are one or more select elements on the Web page, an onchange event on one, can update the options in another select element on the Web page. By clicking Post Your Answer, you agree to our terms of service, privacy policy and cookie policy. If you want to report an error, or if you want to make a suggestion, do not hesitate to send us an e-mail: tag ID to