By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,833 Members | 2,067 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,833 IT Pros & Developers. It's quick & easy.

make certain values in select box greyed out and unselectable?

P: n/a
I'm looking to have a form where a drop down list contains my full range of
options even when some are not currently available. Is it possible to
produce a select box where some items could show differently (eg greyed out)
and not be selectable?

All suggestions welcome!!

Thanks

John
Jul 20 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
"john" <ne**@definitely.no-spam.org.uk> writes:
I'm looking to have a form where a drop down list contains my full range of
options even when some are not currently available. Is it possible to
produce a select box where some items could show differently (eg greyed out)
and not be selectable?


<select>
<option>Yes</option>
<option disabled="disabled">No</option>
</select>

Since you are asking in a javascript group, I assume you need to
change the disabled state of an option dynamically:

formRef.elements['mySelect'].options[1].disabled=true;

/L
--
Lasse Reichstein Nielsen - lr*@hotpop.com
Art D'HTML: <URL:http://www.infimum.dk/HTML/randomArtSplit.html>
'Faith without judgement merely degrades the spirit divine.'
Jul 20 '05 #2

P: n/a
Thanks Lasse - I'd no idea this was a standard select box feature (Doh!),

John

Lasse Reichstein Nielsen <lr*@hotpop.com> wrote in message news:<br**********@hotpop.com>...
"john" <ne**@definitely.no-spam.org.uk> writes:
I'm looking to have a form where a drop down list contains my full range of
options even when some are not currently available. Is it possible to
produce a select box where some items could show differently (eg greyed out)
and not be selectable?


<select>
<option>Yes</option>
<option disabled="disabled">No</option>
</select>

Since you are asking in a javascript group, I assume you need to
change the disabled state of an option dynamically:

formRef.elements['mySelect'].options[1].disabled=true;

/L

Jul 20 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.