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