Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CSS selector for disabled input type="submit"

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?

like image 671
Francisc Avatar asked Sep 21 '10 11:09

Francisc


People also ask

How do I select a disabled element in CSS?

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.

How do I select a Submit button in CSS?

input[type=submit]:disabled, button:disabled { ... } You can substitute [disabled=disabled] (attribute value) with [disabled] (attribute presence).

How do I turn off input submit?

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.

What is the correct selector for targeting all text inputs that are not disabled CSS?

The :enabled pseudo-class in CSS selects focusable elements that are not disabled, and therefore enabled.


1 Answers

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).

like image 141
jensgram Avatar answered Sep 21 '22 01:09

jensgram