Create an options group in HTML

王林
Release: 2023-08-31 17:57:07
forward
1177 people have browsed it

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>
Copy after login

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!

source:tutorialspoint.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template