WML <optgroup> Tag



        The <optgroup/> element is used to group various options together inside a selectable list.

        Attributes:

        This element supports the following attributes:

        Attribute Value Description
        title text Sets a title for the list
        xml:lang language_code Sets the language used in the element
        class class data Sets a class name for the element.
        id element ID A unique ID for the element.

        Example:

        Following is the example showing usage of this element.

<?xml version="1.0"?>
<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.2//EN"
"http://www.wapforum.org/DTD/wml12.dtd">

<wml>

<card title="Selectable List"> 
<p>
 <select>
   <optgroup title="India">
    <option value="delhi">Delhi</option>
    <option value="mumbai">Mumbai</option>
    <option value="hyderabad">Hyderabad</option>
   </optgroup>

   <optgroup title="USA">
    <option value="ohio">Ohio</option>
    <option value="maryland">Maryland</option>
    <option value="washington">Washingtone</option>
   </optgroup>
 </select>
</p>
</card>

</wml>

When a user loads above code, then it will give two options to be selected:

WAP Example 26

When a user select any of the options, then only it will give final options to be selected. So if user selects India, then it will show you the following options to be selected:

WAP Example 27
Advertisements