これは基本的に複数選択のテスト ページです。各 div クラスの .choice には回答 (選択肢 1 ~ 5 など) が含まれています。
$('.choice').click(function () {
checkAnswer(this.id, this.title);
});
そして、checkAnswer は正しいまたは正しくないメッセージを表示し、次の一連の質問にスクロールします。問題は、「次の」リンクに次の回答divのセットが再びクリック可能になるように表示されたときに、1つの選択肢のみをクリックしてもらいたいことです。
アンバインド バインド オン オフ 追加/削除 クラス 何か 何か これが HTML です
<div class="wrap-choices">
<div id="1a" title="Q1" class="choice">
<p>
<span>A. </span>Car
</p>
</div>
<div id="1b" title="Q1" class="choice">
<p>
<span>B. </span>Cat
</p>
</div>
<div id="1c" title="Q1" class="choice">
<p>
<span>C. </span>Cow
</p>
</div>
<div id="1d" title="Q1" class="choice">
<p>
<span>D. </span>All of the above
</p>
</div>
配列内の回答を確認する部分は次のとおりです
function checkAnswer(answerID,qNumber) {
var arr = ['1d', '2c', '3d', '4b'];
var correct = $.inArray(answerID, arr);
//display an incorrect or correct popup
if (correct > -1) {
$('.' + qNumber + ' .correct').show();
} else {
$('.' + qNumber + ' .incorrect').show();
}
//add code to disable clicking any other div here
$('.next').show();
//and then when clicking on that next image, the click is enabled again for those divs
};