180
rated 0 times
[
182]
[
2]
/ answers: 1 / hits: 25513
/ 11 Years ago, wed, july 31, 2013, 12:00:00
I have an HTML page in which I have 2 select
s.
<select id=field name=field onchange=checkValidOption();>
<option />
<option value=Plugin ID>Plugin ID</option>
<option value=Name>Name</option>
</select>
<select id=operator name=operator onchange=checkValidOption();>
<option />
<option value=EQUALS>EQUALS</option>
<option value=CONTAINS>CONTAINS</option>
<option value=NOT CONTAINS>NOT CONTAINS</option>
<option value=REGEX>REGEX</option>
</select>
What I'd like to happen is that checkValidOption()
could make it so that if Plugin ID is selected in field that the only option is EQUALS (and it's selected) and otherwise all the other options are available. Any idea on how to approach this?
I tried changing the innerHTML
of the operator select in JS:
document.getElementById(operator).innerHTML =
<option value='EQUALS'>EQUALS</option>;
However this results in an empty select
(this would also include manually setting the many option
s for going back to having all the ones listed above).
I can't think of another solution, any help would be greatly appreciated.
More From » html