Skip to content

Commit

Permalink
Disable button on result reveal
Browse files Browse the repository at this point in the history
  • Loading branch information
kyletimmermans committed Jan 22, 2024
1 parent ee79d4f commit fd9317d
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 6 deletions.
7 changes: 7 additions & 0 deletions app.js
Original file line number Diff line number Diff line change
Expand Up @@ -675,12 +675,19 @@ const checkAnswer = () => {
"</span>";
}

// Disable button to prevent issues
var answerButton = document.getElementById("check-button");
answerButton.disabled = true;

// Wait 5 seconds for user to read corrected answer, then reset
setTimeout(() => {
// Reset Result and input answer field
document.getElementById("result").innerHTML = "Result: ";
document.getElementById("inputAnswer").value = "";

// Re-enable button
answerButton.disabled = false;

// Find out which exercise we need to get a new question from
// By looking at the current title that we set
currExerciseType = document.querySelector("#centered-title").textContent;
Expand Down
2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ <h1 class="col" id="centered-title">Verb Conjugations</h1>
</div>
<div class="row">
<input class="form-control-lg" id="inputAnswer" type="text" placeholder="Answer" spellcheck="false">
<button type="button" class="btn btn-outline-info" onclick="checkAnswer()">Check</button>
<button type="button" id="check-button" class="btn btn-outline-info" onclick="checkAnswer()">Check</button>
</div>
<div class="row" style="margin-top: 6.7vh;">
<div class="col" id="result">Result: </div>
Expand Down
10 changes: 5 additions & 5 deletions mobile.html
Original file line number Diff line number Diff line change
Expand Up @@ -115,10 +115,10 @@ <h5 class="modal-title" id="aboutModalLabel">About</h5>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">
Made with 💚 by <a href="https://www.kyles.world/" target="_blank" rel="noopener noreferrer">Kyle</a>
<br><br>
Found a vocab / grammar issue or technical bug? Have an improvement in mind? Let me know on <a href="https://www.github.com/rus-grammar-practice/rus-grammar-practice.github.io" target="_blank" rel="noopener noreferrer">GitHub</a>!
<br><br>
<div>Made with 💚 by <a href="https://www.kyles.world/" target="_blank" rel="noopener noreferrer">Kyle</a></div>

<p style="margin-top: 3.35vh; margin-bottom: 3.35vh">Found a vocab / grammar issue or technical bug? Have an improvement in mind? Let me know on <a href="https://www.github.com/rus-grammar-practice/rus-grammar-practice.github.io" target="_blank" rel="noopener noreferrer">GitHub</a>!</p>

<i>Russian Learning Resources:</i>
<ul>
<li><a href="http://russiandrills.byu.edu/" target="_blank" rel="noopener noreferrer">BYU Russian Drills</a></li>
Expand Down Expand Up @@ -156,7 +156,7 @@ <h1 class="col" id="centered-title">Verb Conjugations</h1>
<br>
<div class="row">
<input class="form-control-lg" id="inputAnswer" type="text" placeholder="Answer" spellcheck="false">
<button type="button" class="btn btn-outline-info" onclick="checkAnswer()">Check</button>
<button type="button" id="check-button" class="btn btn-outline-info" onclick="checkAnswer()">Check</button>
</div>
<br><br>
<div class="row">
Expand Down

0 comments on commit fd9317d

Please sign in to comment.