:disabledS2C Home « Selectors « :disabled

UI element states pseudo-class match selector.

Shorthand version  $(':disabled')

Description

The :disabled selector, selects all disabled elements.

Syntax


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

Parameters

None.

Return

N/A.

:disabled Examplego to top of page Top

Selects all disabled elements.

The following rather contrived example will check for disabled input elements and set a message in them with a yellow background when the button below is clicked.


$(function(){
  $('#btn20').on('click', function() {
    $("input:disabled").css('backgroundColor', 'yellow')
                       .val("this field disabled"); 
  });
}); 

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