I need to style disabled
<select>
elements to make them look like they're enabled. Can someone help?
PS. I am all-too-aware of the downsides of doing this sort of thing vis a vis HCI principles etc., but its a requirement so I've got to do it if it is possible ...
Thanks.
EDIT:
@AlexThomas' method works well when the elements are disabled in HTML code but unfortunately I'm doing the disabling/enabling with JQuery:
<select class='dayselector'>
<option>Monday</option>
<option>Tuesday</option>
<!-- .... etc. -->
</select>
$(".dayselector").attr("disabled",true);
$(".dayselector").attr("disabled",false);
So the selector:
$(".dayselector") //works and gets all the selects
and
$(".dayselector option") //works and gets all the selects' option items
but$(".dayselector [disabled='true']") //doesn't return anything.
and
`$(".dayselector [disabled='false']") //doesn't return anything.
Is there something I'm missing?
You could either go with
select[disabled] { }
(not supported in <IE7)
or
select:disabled { }
(not supported in <IE9)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With