Skip to main content
Known Participant
March 22, 2007
Question

Grey out drop down list

  • March 22, 2007
  • 7 replies
  • 2706 views
H,i,

Does any one know how you can set a drop down list as inactive and greyed out in code?
I am using ASP and javascript.

regards

Fifo
This topic is closed to new replies. Start a new post to keep the conversation going.

7 replies

Inspiring
March 22, 2007
fifo85 wrote:

> H,i,
>
> Does any one know how you can set a drop down list as inactive and greyed out in code?
> I am using ASP and javascript.
>
<select disabled>

http://www.w3schools.com/tags/tryit.asp?filename=tryhtml_select3
Mick

fifo85Author
Known Participant
March 22, 2007
Thaks for that Mick
One more thng. How would i be able to set the drop down inactive within an if statement using javascript,
Basically i want to control the disabled attribute based on the condition in the if statement.
Hence i am looking for something like: -

<html>
<body>

<form action="">
<select name="cars">
<option value="volvo">Volvo</option>
<option value="saab">Saab</option>
<option value="fiat" selected="selected">Fiat</option>
<option value="audi">Audi</option>
</select>
</form>
<%if (condition) {
Select("cars") disabled="disabled"; //Something like this hence controlling the disabled state outside of the
} //select clause.

</body>
</html>

I hope am making sense,

Regards
Fifo
Inspiring
March 22, 2007
There's an HTML tag to do it. Add
disabled="disabled"
as an attribute

HTH,

Piers