How to Disabled a dropdownlist in HTML

In this article we will discuss about how to disable the dropdownlist in HTML.
  • 2001

If we want to make the dropdownlist in HTML disable then we can use the disabled attribute of select tag in HTML. This is useful in the condition when we don't want the user to select the option from dropdownlist. It will depend on our application's requirement & when if we want that the user must select any checkbox then he will be enable to select the dropdownlist for it we have to include any scripting language functionality.

HTML Code:

<html>

<body bgcolor="silver">

    <select>

        <option value="select">--select--</option>

        <option value="red">red</option>

        <option value="green">green</option>

    </select>

    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<select disabled="disabled">

        <option value="select">--select--</option>

        <option value="red">red</option>

        <option value="green">green</option>

    </select>

</body>

</html>

 

Output:

 selectt.jpg

In the above output we have seen one dropdownlist is enabled and second dropdownlist is disabled.

Ask Your Question 
 
Got a programming related question? You may want to post your question here
 

Categories

More Articles

© 2020 DotNetHeaven. All rights reserved.