在下面的jquery代码checkBoxName.on('change', function() {
将在第二次触发我会检查复选框后,我在复选框中调用功能foo
onchange
,为什么它不工作我第一次检查盒子?功能第一次不工作
function foo (arg1,arg2,arg3) {
$(document).ready(function() {
$('#checkBox').on('change', function() {
if ($('#checkBox').is(':checked')) {//this is triggered after the second time i check the box
$('#errorDiv').removeClass(errorClass);
$('#submitBtn').removeAttr("disabled");
} else {
$('#submitBtn').attr('disabled', 'disabled');
$('#errorDiv').addClass(errorClass);
}
});
});
}
你为什么缠绕文档准备功能 – j08691
您的富功能@ j08691因为我传递一些参数传递给'foo'我没有在这里提到 – Sherif