0

我正在使用此代码来检查用户选择的复选框是否少于总复选框,以便显示 jquery 确认用户是否要继续。如果由于用户选择较少复选框而出现确认弹出窗口,则表单不提交任何内容。有什么错误?

JAVASCRIPT

var modulo = $("[type='checkbox']").length;
var count = $("[type='checkbox']:checked").length;

if (count < modulo) {
    $.confirm({
        boxWidth: '30%',
        useBootstrap: false,
        title: 'Conferma',
        type: 'red',
        content: 'You have selected ' + count + ' objects of ' + modulo + '. Do you want to proceed?',
        buttons: {
            '
            confirm ': {
            text: 'Yes',
            btnClass: 'btn-info',
            action: function() {
                $("#veicoli").submit();
            }
        },
        'No': function() {}
    }
});

    return false;

} else {

    return true;

}

HTML

<form name="veicoli" id="veicoli" method="post" action="page.php" >
<input type="checkbox" name="rinnovo[44058]" value="renewal" />
<input type="checkbox" name="rinnovo[44059]" value="renewal" />
<input type="checkbox" name="rinnovo[44060]" value="renewal" />
<input type="checkbox" name="rinnovo[44061]" value="renewal" />
<button type="submit" name="compRinnovo" value="Prosegui" onClick="return verifica(this);">Send</button>
</form>
4

0 回答 0