Skip to content

Commit

Permalink
adjusted form submission logic
Browse files Browse the repository at this point in the history
  • Loading branch information
Habilya committed May 29, 2024
1 parent b6d4c49 commit bd767b1
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
2 changes: 1 addition & 1 deletion docs/game-w.html
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ <h1 class="hud-main-text" id="score">
<h2 id="question">What is the answer to this questions?</h2>
<div class="form-group flex-center flex-column">
<h3 id="lbl-answer-comment" class="incorrect-label"></h3>
<form id="answerForm">
<form id="answerForm" onsubmit="event.preventDefault(); answerSubmitCallBack();">
<input type="text" autocomplete="off" class="form-control" id="inputAnswer" aria-describedby="answerComment" placeholder="Your answer here">
</form>
<a id="btn-submit-answer" class="btn">Submit</a>
Expand Down
5 changes: 2 additions & 3 deletions docs/game-w.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,9 @@ getNewQuestion = () => {
inputAnswer.value = '';
};

answerForm.addEventListener("submit", (e) => { answerSubmitCallBack(e); }, false);
submitAnswerButton.addEventListener('click', (e) => { answerSubmitCallBack(e); }, false);
submitAnswerButton.addEventListener('click', answerSubmitCallBack(), false);

answerSubmitCallBack = (e) => {
answerSubmitCallBack = () => {
if (!acceptingAnswers) return;

acceptingAnswers = false;
Expand Down

0 comments on commit bd767b1

Please sign in to comment.