小编Rya*_*yan的帖子

为什么我的函数不会返回true?

即使勾选了我在页面上的两个复选框,我似乎也无法使此函数返回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)

javascript jquery

-3
推荐指数
1
解决办法
98
查看次数

标签 统计

javascript ×1

jquery ×1