Gray out

tastysite

Proficient

Posts: 349

Loc: Brighouse, West Yorkshire, England

3+ Months Ago

How do you make a text box grayed out when somthing happens? I have a box that says where do you live and it has lots of choises and I think I have coved them all but just in case I added a Other one and please say where but I want that grayed out unless they click on other!

casablanca

Proficient

Posts: 483

3+ Months Ago

I assume you're talking about a form on a web page. Well, you need to use JavaScript:

Wouldn't using a class make it so that you can control the appearance of the input box and make it gray using the CSS?

spork

Brewmaster

Posts: 6299

Loc: Seattle, WA

3+ Months Ago

The styling applied in the class wouldn't truly disable the input field, only give the appearance of being disabled.

jameson5555

Bronze Robot

Posts: 575

Loc: Phoenix, AZ

3+ Months Ago

Oh, that makes sense.. so then how do you make it gray? Do you need to add some more JavaScript to change the class, too? Or would it be better to just change the color in that same JavaScript function?

Bogey

Genius

Posts: 8488

Loc: USA

3+ Months Ago

When you disable the field it automatically becomes gray.

jameson5555

Bronze Robot

Posts: 575

Loc: Phoenix, AZ

3+ Months Ago

Oh, duh... lol

spork

Brewmaster

Posts: 6299

Loc: Seattle, WA

3+ Months Ago

Senior moment?

jameson5555

Bronze Robot

Posts: 575

Loc: Phoenix, AZ

3+ Months Ago

Hey, we old guys just need to ask a few more stupid questions to keep up with you youngsters