how can I find all checkboxes, that are checked and not disabled?
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
$('input[type="checkbox"]').filter(function() {
return !this.disabled && this.checked;
})
回答2:
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.
回答3:
$('input[type="checkbox"]:checked').not(":disabled");
Here's a fiddle
回答4:
You can use this selector..
$('input[type=checkbox]:checked:not(:disabled)')
Check This FIDDLE
回答5:
how about $("input[type='checkbox']:checked:enabled")
?