Fixed whitespace issue when checking input against answer.
This commit is contained in:
parent
a8a141f3df
commit
bb1a6e15ec
@ -44,10 +44,12 @@ $(document).keypress (e) ->
|
|||||||
|
|
||||||
$("#submit-answer").click (e) ->
|
$("#submit-answer").click (e) ->
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
answers = $('#answer').text().split(/[,\.]/g);
|
||||||
|
answers = $.map(answers, (x) -> )
|
||||||
input_answer = document.getElementById('kana').value;
|
input_answer = document.getElementById('kana').value;
|
||||||
if($("#kana").hasClass("correct"))
|
if($("#kana").hasClass("correct"))
|
||||||
refreshQuestion();
|
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");
|
$("#kana").addClass("correct").removeClass("wrong");
|
||||||
else
|
else
|
||||||
$("#kana").addClass("wrong").removeClass("correct").val('')
|
$("#kana").addClass("wrong").removeClass("correct").val('')
|
||||||
|
@ -44,5 +44,6 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<script src="{{ url_for('static', filename='wanakana.min.js')}}"></script>
|
||||||
<script defer src="{{ url_for('static', filename='quiz_item.js')}}"></script>
|
<script defer src="{{ url_for('static', filename='quiz_item.js')}}"></script>
|
||||||
{% endblock %}
|
{% endblock %}
|
Loading…
Reference in New Issue
Block a user