:enabledS2C Home « Selectors « :enabled

UI element states pseudo-class match selector.

Shorthand version  $(':enabled')


The :enabled selector, selects all enabled elements.

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 example below to narrow the search and improve performance.


Signature Description
jQuery(':enabled')UI element states pseudo-class match





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

  $('#btn22').on('click', function() {
    $("input[name]:enabled").css('backgroundColor', 'yellow')
                            .val("enter input"); 

Please fill in the form:

Your Information

 Enter your name:

Press the button below to action the above code: