即使勾选了我在页面上的两个复选框,我似乎也无法使此函数返回true.我已经在这个工作了几个小时,现在已经没想完了.任何帮助将非常感激.
if(myfunction() == true){
alert('YAY!');
}
function myfunction(){
if($("input[type=checkbox]").length > 0){
$('.checkbox').each(function(){
if($(this).prop('checked')){
return true;
}
else{
$(this).find(".CheckboxCheck").show();
return false;
}
});
}
else{
return true;
}
}
Run Code Online (Sandbox Code Playgroud)