Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Twiiter Bootstrap - form dropdown dividers and headings

Using Twitter Boostrap, I'm trying to create a form dropdown with dividers within the dropdown, corresponding to each section. Is that possible?

JSFiddle included

I'd like to create something like:

<!--GROUP-->
<option>1</option>
<option>2</option>
<option>3</option>
<!--GROUP-->
<option>4</option>
<option>5</option>
<option>6</option>
like image 258
snakesNbronies Avatar asked Dec 04 '12 08:12

snakesNbronies


1 Answers

To achieve this, you could use optgroup

<div class="container">
    <select>
        <optgroup label="Group 1">
            <option>Item 1</option>
            <option>Item 2</option>
            <option>Item 3</option>
        </optgroup>
        <optgroup label="Group 2">
            <option>Item 1</option>
            <option>Item 2</option>
            <option>Item 3</option>
        </optgroup>
    </select>
</diV>​

Updated fiddle: http://jsfiddle.net/codovations/M8pSH/

like image 199
naveen Avatar answered Nov 15 '22 12:11

naveen