我正在尝试使用数组更新 userPoints 文本框。
var points = new Array();
points[0] = [10];
points[1] = [15];
points[2] = [5];
points[3] = [10];
points[4] = [15];
points[5] = [10];
points[6] = [15];
points[7] = [10];
points[8] = [15];
points[9] = [15];
function rightOrWrongAnswer(){
$("#choiceSelector > ol > li").click(function() {
// for userChoice when they click, turn it into text
var userChoice = $(this).text();
// userChoice equals answers
if(userChoice == answers[count]){
// change that answer to green
$(this).css("color", "green");
我认为这是下面这一行的问题。
// update the points box
userPoints += points[0];
或者可能是我在此处更新文本框时
$("#userPoints").val(points[count]);
}
});