:enabledS2C Home « Selectors « :enabled
UI element states pseudo-class match selector.
Shorthand version  $(':enabled')
Description
The :enabled selector, selects all enabled elements.
- The :enabledselector should only be used for selecting HTML elements that support the disabled attribute, these being (<button>, <input>, <optgroup>, <option>, <select>, <textarea>, and <fieldset>).
- The :enabledselector is subtly different from using the :not() Selector via:not([disabled]):- The :enabledselector matches elements that have their booleandisabledproperty strictly set tofalse.
- The :not() Selector using :not([disabled])matches elements that do not have adisabledattribute set (regardless of its value).
 
- The 
- If this selector is not preceded by another selector, the universal selector ("*") is implied and so the whole DOM will be searched. Use another selector as in the examples below to narrow the search and improve performance.
Syntax
| Signature | Description | 
|---|---|
| jQuery(':enabled') | UI element states pseudo-class match | 
Parameters
None.
Return
N/A.
:enabled ExampleTop
	Selects all enabled elements.
The following example will check for enabled input elements with an attribute of name (our input fields below) and set a message in them with a yellow background when the button below is clicked.
$(function(){
  $('#btn1').on('click', function() {
    $("input[name]:enabled").css('backgroundColor', 'yellow')
                            .val("enter input"); 
  });
}); 
Please fill in the form:
 
  
  
  