我正在使用此代码来检查用户是否选择了比总复选框少的复选框,以便显示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>