By using this site, you agree to the use of cookies, our policies, copyright terms and other conditions. By clicking Accept all cookies, you agree Stack Exchange can store cookies on your device and disclose information in accordance with our Cookie Policy. Why was the nose gear of Concorde located so far aft? In this How Can I get the previous Selected Value from my select box? as in example? Thanks alot. rev2023.3.1.43269. Wrap <form></form> around <select> tag In some rare instances you may need to use parentheses, but this would be very rare. Asking for help, clarification, or responding to other answers. Book about a good dark lord, think "not Sauron". 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! But if you dynamically create those drop down menus, you can only use 'live', that's what I know. The onchange attribute fires the moment when the value of the element is changed.. How does a fan in a turbofan engine suck air in? Is Hahn-Banach equivalent to the ultrafilter lemma in ZF. Is there a proper earth ground point in this switch box? This is my component: The output of both the code will be similar, as shown below. You can also reference with onchange event-. You can grab the value in one line: I wonder that everyone has posted about value and text option to get from