:enabled Back
- In comparison with
:disabled
,:enabled
is a pseudo-class selector used to select and style user interface elements (usually form elements) that are enabled. :enabled
allows us to select only the enabled user interface elements, thus filtering out the disabled ones.
Case: enable button with hover
See the Pen xZXYaj by aleen42 (@aleen42) on CodePen.
Note
- The
enabled
attribute is an HTML5 attribute that can be set to the elements:<button>
,<input>
,<textarea>
,<optgroup>
,<option>
, and<fieldset>
. - In comparison,
:disabled
is to disable elements as a disabled state. - The
display
andvisibility
properties have no effect on the enabled/disabled state of an element, even if they are set to hide the element.