Link to home
Start Free TrialLog in
Avatar of stevengreen
stevengreen

asked on

DropDownList plain HTML

Hi Guys,

What is the code for putting a separator in a select/option box (dropdownlist). I've come accross it once, but forgot to save it. It's something more intellegent than putting <option>----------</option> in the select.

Any help would be greatly appreciated.

thanks
Stevengreen
ASKER CERTIFIED SOLUTION
Avatar of dorward
dorward

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of stevengreen
stevengreen

ASKER

Hi,

Not quite what i was looking for.  I need to apply an <optgroup> to a dropdownlist in asp.net. Sorry I did put this in the wrong group ;-)

Thanks
Stevengreen
This might be helpful:

<SELECT NAME=browser>
    <OPTION>1</OPTION>
    <OPTION>2</OPTION>
    <OPTION disabled="disabled">&mdash;&mdash;&mdash;&mdash;&mdash;</OPTION>
    <OPTION>A</OPTION>
    <OPTION>B</OPTION>
</SELECT>

Open in new window

Avatar of Michel Plungjan
Only in FF

Alternative is


<SELECT NAME=browser onChange="if (this.options[this.selectedIndex].value=="---") this.options[this.selectedIndex-1].selected=true">
    <OPTION>1</OPTION>
    <OPTION>2</OPTION>
    <OPTION value="---" disabled="disabled">&mdash;&mdash;&mdash;&mdash;&mdash;</OPTION>
    <OPTION>A</OPTION>
    <OPTION>B</OPTION>
</SELECT>
 
or 
<SELECT NAME=browser onChange="if (this.options[this.selectedIndex].value=="---") this.selectedIndex--;">

Open in new window