-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a427b28
commit 7195c29
Showing
3 changed files
with
14 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,41 +1,35 @@ | ||
// generate Button Event Handler | ||
const generateBtn = document.getElementById('generate-pin') | ||
generateBtn.addEventListener('click', function () { | ||
const generateBtn = document.getElementById('generate-pin').addEventListener('click', function () { | ||
const generateRandomNumber = Math.floor(1000 + Math.random() * 9000); | ||
|
||
document.getElementById('show-pin').value = generateRandomNumber; | ||
}) | ||
|
||
// Submit Button Event Handler | ||
document.getElementById('submit').addEventListener('click', function () { | ||
const showPin = document.getElementById('show-pin').value; | ||
const numberView = document.getElementById('numView').value; | ||
const warning = document.getElementById('errorCount').value; | ||
|
||
if (showPin == numberView && showPin != 0) { | ||
const submitOutput = document.getElementById('matched'); | ||
submitOutput.style.display = 'block'; | ||
document.getElementById('numView').value = ""; | ||
document.getElementById('show-pin').value = ""; | ||
// for remove the 3 try left | ||
const errorCount = document.getElementById('errorCount'); | ||
errorCount.style.display = 'none'; | ||
// for remove the 3 try left | ||
const errorCounter = document.getElementById('errorCounter'); | ||
errorCounter.style.display = 'none'; | ||
} | ||
|
||
if (showPin != numberView || showPin == 0) { | ||
const submitError = document.getElementById("error"); | ||
submitError.style.display = 'block'; | ||
document.getElementById('numView').value = ""; | ||
document.getElementById('show-pin').value = ""; | ||
} | ||
}) | ||
|
||
document.getElementById('generate-pin').addEventListener('click', function () { | ||
const removeSuccess = document.getElementById('matched'); | ||
const removeError = document.getElementById('error'); | ||
const showTry = document.getElementById('errorCount'); | ||
const showTry = document.getElementById('errorCounter'); | ||
|
||
removeSuccess.style.display = 'none'; | ||
removeError.style.display = 'none'; | ||
showTry.style.display = 'block'; | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters