Is it possible to disable an input box with pure CSS?
I need to do this javascript equivalent:
document.forms['myform'].myinput.disabled = true;
Can it be done inline?
Lance
6:07 pm on Nov 8, 2004 (gmt 0)
Disabled is an attribute, not a style. I don't believe there is any way to disable a control with css. That said, you can hide (VISIBILITY: hidden) or remove (DISPLAY: none) a control using css though.
encyclo
6:17 pm on Nov 8, 2004 (gmt 0)
Do you want it to be temporarily or permanently disabled? If it's the former, then you've got no choice other than to use Javascript: CSS is for adding styles, not functionality. If the latter, you can simply add the appropriate HTML attribute:
<input type="text" disabled="disabled">
mattglet
6:42 pm on Nov 8, 2004 (gmt 0)
I am aware of the difference between attributes and styles, just didn't know if CSS had some trick that I could use. Thanks for the confirmation.
DrDoc
7:40 pm on Nov 8, 2004 (gmt 0)
I am aware of the difference between attributes and styles
Well, that's the answer to your question. CSS only controls look and feel with regards to layout, but has nothing to do with functionality of an element.
mattglet
8:11 pm on Nov 8, 2004 (gmt 0)
Agreed. My only partial knowledge of what CSS can actually accomplish led me to the question.