The presence of this set of fields:
<fieldset> <legend>[*death]</legend> <select name=death style="width: 120px"> <option value=Dead>[*died] <option value=NotDead>[*alive] <option value="" selected>- </select> </fieldset>
I want to set [2].value to "-" .
I tried without any success:
document.getElementsByName('death')[2].checked = 'true'; document.getElementsByName('death')[2].value = '-';
The same code is great for radio boxes, marked boxes or other inputs on the form. How to do this with selecting an option (which is not input)?
thanks
[EDIT], of course, a suitable set of fields:
<fieldset> <legend>[*death]</legend> <select name="death" style="width: 120px"> <option value="Dead">[*died]</option> <option value="NotDead">[*alive]</option> <option value="" selected>-</option> </select> </fieldset>
thanks.
source share