diff --git a/static/quiz_item.coffee b/static/quiz_item.coffee index 22f5f38..a0f8ae4 100644 --- a/static/quiz_item.coffee +++ b/static/quiz_item.coffee @@ -44,10 +44,12 @@ $(document).keypress (e) -> $("#submit-answer").click (e) -> e.preventDefault(); + answers = $('#answer').text().split(/[,\.]/g); + answers = $.map(answers, (x) -> ) input_answer = document.getElementById('kana').value; if($("#kana").hasClass("correct")) refreshQuestion(); - else if($('#answer').text().split(/[,\.]/g).indexOf(input_answer) != -1) + else if($('#answer').text().split(/[,\.]/g).map((x) -> x.trim()).indexOf(input_answer) != -1) $("#kana").addClass("correct").removeClass("wrong"); else $("#kana").addClass("wrong").removeClass("correct").val('') diff --git a/templates/quiz.html b/templates/quiz.html index 66298b6..c3301e9 100644 --- a/templates/quiz.html +++ b/templates/quiz.html @@ -44,5 +44,6 @@ + {% endblock %} \ No newline at end of file