在使用jquery验证checkbox是否选中的时候,一般思维是采用typeof($(this).prop("checked"))!='undefined' 这种方式来判断,但是实验发现,在点击checkbox框的时候,<input type="checkbox" >后面根本没有增加checked属性,所以在这里需要使用prop函数$(this).prop("checked"),返回类型为true or false,比如判断所有的checkbox是否有选中的,如果没有,返回false:
$("#fm2").find(":checkbox").each(function(){
if($(this).prop("checked")){
return false;
}else{
return true;
}
});