Hello. I want to disable a checkbox without adding "disable" to the HTML. Basically, I want it to LOOK like an enabled checkbox but when someone clicks on it, nothing happens. How can I accomplish this?
dep
_Aerospace_Eng_
03-15-2006, 07:00 PM
Hmm readonly only works on input boxes not checkboxes. Why are you doing this anyways? Why not just pass a hidden input value to symbolize the "untouchable checkbox"?
Beagle
03-15-2006, 07:28 PM
<input type="checkbox" onclick="return false;" />
well, it's for a validation status on category. the checkbox fills in when the category is complete... Problem is, on XP, if you don't have "fancy windows" turned on in your OS, it renders the 'disabled' elements in a very dark grey and you can't really see the checkbox's checked status..
btw onclick="return false;" works.
thanks!@
brothercake
03-16-2006, 01:46 AM
well, it's for a validation status on category. the checkbox fills in when the category is complete... Problem is, on XP, if you don't have "fancy windows" turned on in your OS, it renders the 'disabled' elements in a very dark grey and you can't really see the checkbox's checked status..
So you're saying, you want to do this because you don't think the appearance of a disabled control is good enough?
If so, that's entirely the wrong reason - having an element disabled is a semantic state, and if that's the state you mean (as it is) then that's the state you should use.
If you want to use scripting to read the state and restyle the checkbox, that's cool (it would be better to use the :disabled pseudo-class, but of course IE doesn't currently support that). But you should not use scripting to simulate a state which conflicts with the actual state of the element.
Am I making sense here?
By short. Most users know how a disabled checkbox looks like. They must have been used with it till now. Changing the appeearance of an welknown element status will confuse al lot of them, I bet.