Skip to content
Advertisement

Trying to take hidden input value with hidden mySQL ID

When I choose an option in my dropdown, I want to take it’s MySQL table ID and put it in a hidden input box. The MySQL table rows are correct, but the input box never changes.

I’m using this to try to retrieve the value:

JavaScript

And this HTML code, with the hidden input box:

JavaScript

Thank you for your help!

Advertisement

Answer

You don’t listen for clicks on options. You should listen for change of the <select>, and get its value.

JavaScript
User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement