J
Joshua Beall
Hi All,
I am doing some JS, and I want to be able to access the currently selected
option in a <select> tag via the DOM. Here's what I'm doing:
<form name="form1">
<select name="option">
<option>East</option>
<option>West<option>
</select>
</form>
Then to access it, I look in the JS variable "document.form1.option.value" -
however, it is blank.
If I change to
<form name="form1">
<input type="text" name="option">
</form>
Then the JS variable "document.form1.option.value" holds whatever I type in
the textbox. Is there some other way I am supposed to access the <select>?
Thanks for any help!
Sincerely,
-Josh
I am doing some JS, and I want to be able to access the currently selected
option in a <select> tag via the DOM. Here's what I'm doing:
<form name="form1">
<select name="option">
<option>East</option>
<option>West<option>
</select>
</form>
Then to access it, I look in the JS variable "document.form1.option.value" -
however, it is blank.
If I change to
<form name="form1">
<input type="text" name="option">
</form>
Then the JS variable "document.form1.option.value" holds whatever I type in
the textbox. Is there some other way I am supposed to access the <select>?
Thanks for any help!
Sincerely,
-Josh