Posts Tagged ‘web forms’

h1

Making Non-selectable options and option groups in select

December 10, 2010

Making Non-selectable options and indented option groups are pretty easy in select control. disabled the options is not a correct way to do, use optgroup option.

Making Non-selectable options :

<select >
<option >groups</option>
<optgroup label=”group1″> </optgroup>
<option> group 1 item 1</option>
<option> group 1 item 2</option>
<optgroup label=”group2″> </optgroup>
<option> group 2 item 1</option>
<option> group 2 item 2</option>
</select>

Making indented option groups:

<select >
<option >groups</option>
<optgroup label=”group1″>
<option> group 1 item 1</option>
<option> group 1 item 2</option>
</optgroup>
<optgroup label=”group2″>
<option> group 2 item 1</option>
<option> group 2 item 2</option
>/optgroup>
</select>

 

Advertisements