0

I am looking for a HTML "select" which can display in groups.

Chosen -- http://harvesthq.github.io/chosen/ can do this but only one level of grouping

I am looking of nested groupings

ex:

Product
   SW
     C1
     C2
   HW
   Infrastrcture
     S1
     S2
Dipen Shah
  • 1,911
  • 10
  • 29
  • 45
KK99
  • 1,971
  • 7
  • 31
  • 64

2 Answers2

0

You can always indent the options text like below to get the desired output

<select>
    <option>Product</option>
    <option>&nbsp;SW</option>
    <option>&nbsp;&nbsp;C1</option>
    <option>&nbsp;&nbsp;C2</option>
    <option>&nbsp;HW</option>
    <option>&nbsp;Infrastrcture</option>
    <option>&nbsp;&nbsp;S1</option>
    <option>&nbsp;&nbsp;S2</option>
</select>

Check here how it looks like.

kiranvj
  • 32,342
  • 7
  • 71
  • 76
-1

I believe what you are looking for is something like this:

Here is the code of the reference site:

<select>
   <optgroup label="Swedish Cars">
      <option value="volvo">Volvo</option>
      <option value="saab">Saab</option>
   </optgroup>
   <optgroup label="German Cars">
      <option value="mercedes">Mercedes</option>
      <option value="audi">Audi</option>
   </optgroup>
</select>
Mike Angel
  • 51
  • 8
  • Thanks. I am looking for more than 1 group. Optgroup supports only one level of grouping I believe – KK99 Aug 12 '15 at 20:47
  • That is correct it supports one group. Anyway you can use ` ` to add the desired space, disable attribute so the option cannot be selected and some `CSS` to give a the disabled option a white background and make the text bold. Example: `` – Mike Angel Aug 12 '15 at 20:57