Reputation: 434
i have check box list and some of them are disable. i have a check box of check_all
and uncheckall
and my code is
$( '#check_all' ).live( 'change', function() {
$( '.waiting_user' ).attr( 'checked', $( this ).is( ':checked' ) ? 'checked' : '' );
$( this ).next().text( $( this ).is( ':checked' ) ? 'Uncheck All' : 'Check All' );
});
its working fine but problem is that it check and uncheck disabled checkbox also
any way to do that checkall and unchekall only enabled echeck box se in image to more detail
and problem is its cheked disabled checkbox also.
Upvotes: 0
Views: 43
Reputation: 2657
$( '#check_all' ).live( 'change', function() {
$( '.waiting_user:enabled").attr( 'checked', $( this ).is( ':checked' ) ? 'checked' : '' );
$( this ).next().text( $( this ).is( ':checked' ) ? 'Uncheck All' : 'Check All' );
});
Upvotes: 0
Reputation: 94499
You can use the psuedo class selector :enabled
$( '.waiting_user:enabled' ).attr( 'checked', $( this ).is( ':checked' ) ? 'checked' : '' );
Upvotes: 2
Reputation: 129832
You can exclude the disabled checkboxes as such:
$('.waiting_user:not(:disabled)')
Upvotes: 2