在下面的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