Jump to content

capturing mulitple values from an html select tag


jnroche

Recommended Posts

my form is<form>

<select name="slctreasons">

<option id="<?" value="<?php echo $reasonID; ?>" ><?php echo $myrows['reason']; ?></option>

</form>the entire list of reasons is captured in that option tag, in a loop ofcourse, to list down all the reason inside the database table.my problem is i want to get both reasonID and reason text itself in javascript. my initial javascript code is:document.getElementById('slctreasons').value this line only gets whatever the value in the selected option is, which is the reasonID! I also wanted the text itself....i dont know much about javascriptany help thanks

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...