在缺少/或值时禁用表单提交jquery!=''&&;价值=';0';

在缺少/或值时禁用表单提交jquery!=''&&;价值=';0';,jquery,jquery-validate,Jquery,Jquery Validate,我正在尝试使用jQuery禁用表单提交,我已经检查了jQuery.validate.js插件 但它不会重新识别我的txtQty[]数组: rules : { 'txtQty[]' : {required: true, minlength: 2} } 但这不起作用 这是我的当前代码,如果 txtQty[] == '0' && txtQty == '' 代码: 即使警报也不会被触发。。。。。。。 thx在第一个。每个,将| |更改为&& $("form#frmCart")

我正在尝试使用jQuery禁用表单提交,我已经检查了jQuery.validate.js插件 但它不会重新识别我的txtQty[]数组:

rules : { 'txtQty[]' : {required: true, minlength: 2} }
但这不起作用

这是我的当前代码,如果

txtQty[] == '0' && txtQty == ''
代码:

即使警报也不会被触发。。。。。。。
thx

在第一个。每个,将| |更改为&&

    $("form#frmCart").submit(function(e) { 
    var err = false;
    var hidCartId = [];
    var hidProductId = [];
    var txtQty = [];
    var artSize = [];
    $("input[name='txtQty\\[\\]']").each(function(index) {
            if($(this).val() != '' || $(this).val() != '0'){
                txtQty.push($(this).attr('value'));
            } else {
                alert("Empty val");
                err = true;
                $(this).focus();
                e.preventDefault(); // Cancel the submit
                return false; // Exit the .each loop


            }
    });

    $("input[name='hidProductId\\[\\]']").each(function(index) { 
            hidProductId.push($(this).attr('value'));
    });

    $("input[name='hidCartId\\[\\]']").each(function(index) {   
            hidCartId.push($(this).attr('value'));
    });

    $("select[name='articleSize\\[\\]']").each(function(index) { 
        if($(this).val() != $(this).attr('value')){
            artSize.push($(this).val());
        } else {
            artSize.push($(this).attr('value'));
        }
    });
    if(err === true){
                e.preventDefault(); // Cancel the submit
                return false; // Exit the .each loop
    } 

    $.ajax({
        cache: false,
        type: "POST",
        url: "cart.php?action=update",
        data: {hidCartId: hidCartId, hidProductId: hidProductId, txtQty: txtQty, size: artSize},
        success: function(result){
            $('#content-container').html(result);       
        }
    });
    return false;

});