jquery选择器,用于未禁用的所有选中复选框

如何找到所有已选中且未禁用的复选框?

$('input[type="checkbox"]').filter(function() { return !this.disabled && this.checked; }) 

像这样:

 $("input[type='checkbox']:checked").not(":disabled")... 

这将查找input s的字段,其类型为checkbox ,已选中并且未禁用。 如果这不起作用,您应该使用属性检查:

 $("input[type='checkbox']:checked").not("[disabled]")... 

或者,正如@lonesomeday精明地指出的那样,你可以将它组合成一个选择器:

 $("input[type='checkbox']:checked:not(:disabled)")... 

我在这个小提琴中整理了一个概念validation。

 $('input[type="checkbox"]:checked').not(":disabled"); 

这是一个小提琴

你可以使用这个选择器..

 ​$('input[type=checkbox]:checked:not(:disabled)')​ 

检查这个FIDDLE

怎么样$("input[type='checkbox']:checked:enabled")