how can I find all checkboxes, that are checked and not disabled?
In Firefox (and maybe others?) : Hit CTRL+SHIFT+K to open the console, then paste : $("input:checkbox"). attr('checked', true) and hit Enter . All check-boxes on current page should now be checked. To un-check change True to False .
Press the disable button and then the enable button. The checkbox doesn't get enabled. As the answers tell it is because the disabled attribute is a boolean attribute.
The disabled property sets or returns whether a checkbox should be disabled, or not. A disabled element is unusable and un-clickable. Disabled elements are usually rendered in gray by default in browsers. This property reflects the HTML disabled attribute.
Like so:
$("input[type='checkbox']:checked").not(":disabled")...
This finds fields that are input
s, with type checkbox
, which are checked, and not disabled. If this does not work, you should use an attribute check:
$("input[type='checkbox']:checked").not("[disabled]")...
Or, as @lonesomeday astutely pointed out, you can combine it into one selector:
$("input[type='checkbox']:checked:not(:disabled)")...
I've put together a proof-of-concept in this fiddle.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With