user1537319
user1537319

Reputation:

Deselect Checkbox

I want to deselect the checkboxes that are in disabled state using JQuery

I used live type with 'change' event in Jquery. The following code deselects all checkboxes. But I need only for disabled checkboxes.

$('.checkboxGroups').removeAttr('checked').trigger('change');

Thanks.

Upvotes: 0

Views: 258

Answers (4)

Waqar Janjua
Waqar Janjua

Reputation: 6123

First you have to find the disable checkboxes using the below statement then perform your opearation.

$('.checkboxGroups').attr('disabled', true)

Upvotes: 0

gaurang171
gaurang171

Reputation: 9080

try this

   $(".checkboxGroups:disabled").prop('checked', false);

Upvotes: 1

Faust
Faust

Reputation: 15394

Use the CSS :disabled pseudo-selector:

$('.checkboxGroups:disabled').removeAttr('checked').trigger('change');

...though given the plurality of the classname -- is '.checkboxGroups' the container?

If so, then:

$('.checkboxGroups input:disabled').removeAttr('checked').trigger('change');

Upvotes: 0

huMpty duMpty
huMpty duMpty

Reputation: 14460

You can use something like

$(".checkboxGroups:disabled")

See more about :disabled Selector

Upvotes: 0

Related Questions