在我的程序中,我一次显示一个问题,然后点击它发布并获得第二个问题。但在我申请的复选框列表中的一些逻辑jQuery的每一个问题,我这样称呼它如何唯一标识checkBox上的jQuery函数更改点击?
$(document).ready(function() {
$("input:checkbox").change(function() {
var txt = $(this).parent().children("label").text();
if ($(this).is(':checked')) {
if ($(this).parent().children("label").text() == 'Not Sure') {
$("input:checkbox").attr('checked', false);
$("input:checkbox").attr('disabled', true);
$(this).attr('checked', true);
$(this).attr('disabled', false);
}
}
else {
if ($(this).parent().children("label").text() == 'Not Sure') {
$("input:checkbox").attr('checked', true);
$("input:checkbox").attr('disabled', false);
$(this).attr('checked', false);
}
}
});
$("input:checkbox").change(function() {
var txt = $(this).parent().children("label").text();
if ($(this).is(':checked')) {
if (txt == 'Not Sure' || txt == 'We Are Large Business' || txt == 'None of these apply') {
$("input:checkbox").attr('checked', false);
$("input:checkbox").attr('disabled', true);
$(this).attr('checked', true);
$(this).attr('disabled', false);
}
}
else {
if (txt == 'Not Sure' || txt == 'We Are Large Business' || txt == 'None of these apply') {
$("input:checkbox").attr('checked', false);
$("input:checkbox").attr('disabled', false);
$(this).attr('checked', false);
}
}
});
});
所以问题是,对于1个问题的逻辑是从其他复选框列表的问题和我不同需要调用相应的函数,如上面你在document.ready中看到的那样有两个函数。那么如何解决一些特定的问题,我应该修复调用函数?