Home  >  Article  >  Web Front-end  >  Create an options group in HTML

Create an options group in HTML

王林
王林forward
2023-08-31 17:57:071156browse

Create an options group in HTML

HTML Tags are used to group related options in a select list. This makes it easier for users to understand their choices when viewing large lists.

The following are the properties-

Properties

Value

Description

Disabled

Disabled

Disable input controls. The button will not accept changes from the user. It also fails to receive focus and is skipped on tabbing.

Tag

Text

define when using tags to use.

Example

You can try running the following code to create an option group in HTML -

<!DOCTYPE html>
<html>
   <head>
      <title>HTML optgroup Tag</title>
   </head>
   <body>
      <select>
         <optgroup label = "India">
            <option value = "mumbai">Mumbai</option>
            <option value = "delhi">Delhi</option>
         </optgroup>
         <optgroup label = "USA">
            <option value = "florida">Florida</option>
            <option value = "newyork">New York</option>
         </optgroup>
      </select>
   </body>
</html>

The above is the detailed content of Create an options group in HTML. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:tutorialspoint.com. If there is any infringement, please contact admin@php.cn delete