Enable text box when specific option is selected

J

jschlosser

I can enable a text box with an onChange if ANY option is selected
from a select list, but how do I do this for a specific selection?
Even better would be if the field didn't appear until after the
event. This is for those selecting "other" to tell us what "other"
is.

Thanks.

J Schlosser
 
P

Peter Michaux

I can enable a text box with an onChange if ANY option is selected
from a select list, but how do I do this for a specific selection?
Even better would be if the field didn't appear until after the
event. This is for those selecting "other" to tell us what "other"
is.

In the onchange event of the select element, examine which option is
currently selected with the selectedIndex property. Then (enable and
show) or (disable and hide) the text area using something like
textarea.disabled=true;textarea.style.display='none';

Give it a try with a complete demo web page that is just 40 lines or
less. If you have troubles you can post that code which will give
people a way to help you better.

Peter
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,576
Members
45,054
Latest member
LucyCarper

Latest Threads

Top