Skip to content
Related Articles

Related Articles

Save Article
Improve Article
Save Article
Like Article

How to disable the drop-down list in HTML5 ?

  • Last Updated : 26 Mar, 2021

The drop-down is used to create a list of items that need to select an element. We use <select> and <option> elements to create a drop-down list and use disabled attribute in <select> element to disable the drop-down list element.  A disabled drop-down list is un-clickable and unusable. It is a boolean attribute.

Syntax:

Attention reader! Don’t stop learning now. Get hold of all the important HTML concepts with the Web Design for Beginners | HTML  course.

<select disabled> Option values... </select>

Attribute Value:

  • disabled: The <select> disabled attribute is used to specify the select element is disabled. A disabled drop-down list is un-clickable and unusable. It is a boolean attribute.

Example:

HTML




<!DOCTYPE html>
<html>
  
<head>
    <title>
        How to disabled drop-down list in HTML5?
    </title>
</head>
  
<body style="text-align: center;">
    <h1 style="color: green;">
        GeeksforGeeks
    </h1>
  
    <h3>
        How to disabled drop-down list in HTML5?
    </h3>
  
    <select disabled>
        <option value="c">C</option>
        <option value="cpp">C++</option>
        <option value="java">Java</option>
        <option value="python">Python</option>
    </select>
</body>
  
</html>

Output:

My Personal Notes arrow_drop_up
Recommended Articles
Page :