:enabledS2C Home « Selectors « :enabled

UI element states pseudo-class match selector.

Shorthand version  $(':enabled')

Description

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.

Syntax


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

Parameters

None.

Return

N/A.

:enabled Examplego to top of page Top

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(){
  $('#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:


go to home page Homepage go to top of page Top