我正在编写一个测验,需要让它根据分数显示某个答案。
当我刚刚显示分数时,我有这个工作,但现在我已经添加了 if else,它已经停止工作并且我得到一个未终止的字符串常量
$total_score = $first_question + $second_question + $third_question + $fourth_question + $fifth_question + $sixth_question + $seventh_question + $eighth_question + $ninth_question + $tenth_question + $eleventh_question + $twelfth_question + $thirteenth_question + $fourteenth_question + $fifthteenth_question + $sixteenth_question ;
});
$("#btn").click(function() {
$('#reveal').html("<h3><strong>Total score</strong> " + $total_score +"</h3>");
if ($total_score >= 13) {
$('#answer').html("<h3><strong>13-16: Answer</strong></h3>");
} else if ($total_score >=9 && $total_score <= 12) {
$('#answer').html("<h3><strong>9-12: answer</strong></h3>");
} else if ($total_score >=5 && $total_score <= 8) {
$('#answer').html("<h3><strong>5-8: answer</strong></h3>");
} else {
$('#answer').html("<h3><strong> everything else</strong></h3>");
}
});