Java Script to Get Selected Item from Select List Option Group
By Stephen Bucaro
An <optgroup> element allows you to group related options in a drop-down select list.
Shown below is code for an example of a select list using <optgroup> elements.
<form id="myForm">
<select id="mySelect" >
<optgroup label="group1">
<option value=1>item1</option>
<option value=2>item2</option>
<option value=3>item3</option>
</optgroup>
<optgroup label="group2">
<option value=4>item4</option>
<option value=5>item5</option>
<option value=6>item6</option>
</optgroup>
</select>
<input type="button" value="Submit" onclick="getOption(this.form)">
<form>
|