Open In App
Related Articles

How to specify that an option-group should be disabled in HTML5 ?

Improve Article
Save Article
Like Article

We will use <optgroup> and <option> tags to create an option-group list and use the disabled attribute with <optgroup> to create a disabled option-group list. The <optgroup> tag is used to create a group of the same category options in a drop-down list. The <optgroup> tag is required when there is a long list of items that exist. The <option> tag in HTML is used to choose an option from a drop-down menu. 


<optgroup label="">
    <option label="">  </option>

Example: In this example, we are using the above-explained method.


<!DOCTYPE html>
        How to specify that an option-group
        should be disabled in HTML5?
<body style="text-align: center;">
    <h1 style="color: green;">
        How to specify that an option-group<br>
        should be disabled in HTML5?
        <optgroup label="Computer Programming" disabled>
            <option value="c">C</option>
            <option value="cpp">C++</option>
            <option value="java">Java</option>
            <option value="python">Python</option>
        <optgroup label="Web Technology">
            <option value="html">HTML</option>
            <option value="css">CSS</option>
            <option value="js">JavaScript</option>
            <option value="jquery">jQuery</option>


Last Updated : 15 May, 2023
Like Article
Save Article
Similar Reads
Related Tutorials