Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to select only enabled fields using jquery

Tags:

jquery

 $('#btnSelectAll').click(function() {
       $('.inputchbox').attr('checked', true);
 });

$('#btnCancel').click(function() {
     $('fieldset:not(:checked)').find("input,select,textarea").removeAttr('disabled');
 });

On cancel I need to enable only the checkboxes which are checked? Can I use something like this?

On selectall button I am selecting all the checkboxes from my fieldset but here I need to select only the enabled checkboxes and the not disabled checkboxes.. So checkboxes are disabled on my fieldset on the load it self?

How to exclude disabled checkboxes?

like image 903
user354625 Avatar asked Apr 11 '26 01:04

user354625


1 Answers

You can use the (':checkbox:enabled') selector to select only enabled checkboxes.

More info on :checked and :enabled

like image 135
Sarfraz Avatar answered Apr 12 '26 20:04

Sarfraz



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!