Create Groups In Drop Down List Box

<html>

<body>

<select>

<optgroup label="Numbers">

<option value="1">One</option>

<option value="2">Two</option>

<option value="3">Three</option>

</optgroup>

<optgroup label="Letters" disabled="true">

<option value="4">A</option>

<option value="5">B</option>

<option value="6">C</option>

</optgroup>

<optgroup label="Numbers set">

<option value="1">One</option>

<option value="2">Two</option>

<option value="3">Three</option>

</optgroup>

</select>

</body>

</html>   

Grouping items in a drop-down list box is easy with the optgroup element. Theoptgroup element is a child to the select element and has two attributes:label (required) and disabled (optional). The required label attribute specifies the text that will appear as a header to the contained group of options. Many browsers render the label text in bold italic. The optional disabled attribute is used to render the entire group of options non-selectable to the user. Options within an option group are indented.

Comments

Popular Posts

SharePoint Interview Questions and Answers

Download Infopath Form Templates

How to get current logged user information using JavaScript ?

Steps to set Form based authentication (FBA) for SharePoint 2010

SharePoint Interview Questions and Answers II

Get List Items - JavaScript

Change Language for current user with JSOM in SharePoint Online

Cross Site List Rollup Web Part for SharePoint 2010

Hide Recently Modified Items

SharePoint 2010 CSS Chart