我做了一个小小的网络测验。
问题是单击后退按钮时,我想重新选择用户的最后一个选择,但它似乎不起作用,我不知道为什么。
这是我的go_back
功能:
function go_back(){
$("#back").bind("click",function(){
qNum--;
if(AnsW.length === 0){
calcAnswers--;
}
tempAns = AnsW[qNum];
//user's last answer, which is false. I need this to make the radio button point to that answer.
showQuestion(qNum);
$("#contain").find("input[value="+tempAns+"]").prop('checked', true);
AnsW.splice(-1,1);
//delete the false answer from the array. I need this to make sure that the answer is deleted and there won't be an overload of wrong answers
if(qNum === 0){
$("#back").css({"visibility":"hidden"})
}
});
}