Is there a CSS selector for disabled input type="submit"
or "button"
?
Should I just use input[type="submit"][disabled]
?
Does that work in IE6?
The :disabled CSS pseudo-class represents any disabled element. An element is disabled if it can't be activated (selected, clicked on, typed into, etc.) or accept focus. The element also has an enabled state, in which it can be activated or accept focus.
input[type=submit]:disabled, button:disabled { ... } You can substitute [disabled=disabled] (attribute value) with [disabled] (attribute presence).
Enable / Disable submit button 1.1 To disable a submit button, you just need to add a disabled attribute to the submit button. $("#btnSubmit"). attr("disabled", true); 1.2 To enable a disabled button, set the disabled attribute to false, or remove the disabled attribute.
The :enabled pseudo-class in CSS selects focusable elements that are not disabled, and therefore enabled.
Does that work in IE6?
No, IE6 does not support attribute selectors at all, cf. CSS Compatibility and Internet Explorer.
You might find How to workaround: IE6 does not support CSS “attribute” selectors worth the read.
EDIT
If you are to ignore IE6, you could do (CSS2.1):
input[type=submit][disabled=disabled], button[disabled=disabled] { ... }
CSS3 (IE9+):
input[type=submit]:disabled, button:disabled { ... }
You can substitute [disabled=disabled]
(attribute value) with [disabled]
(attribute presence).
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