私のプログラムでは、一度に1つの質問を表示し、次にクリックすると投稿であり、2番目の質問が表示されます。しかし、それで問題が1つの質問のためのロジックは、他のチェックボックスリストの質問と私は異なっている、ということです私はjqueryの内の各質問のためのチェックボックスリストのためのいくつかのロジックを適用し、私はcheckBoxのchange clickで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);
}
}
});
});
このようにそれを呼び出します上記のdocument.readyにあるように適切な関数を呼び出す必要がありますが、2つの関数を持っています。だから、私は関数呼び出しを修正する必要がありますいくつかの特定の質問はどうですか?