Created
October 25, 2021 18:15
-
-
Save Octagon-simon/8fc312a52e067df2894ce1dbfeb26363 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| function checkAnswer(x = "this") { | |
| var answer = 25; | |
| var userAnswer = x.value; | |
| if(userAnswer.length >= 2){ | |
| if(userAnswer != answer) { | |
| alert('You have provided an invalid Answer'); | |
| } | |
| } | |
| } | |
| document.addEventListener('DOMContentLoaded', (event) => { | |
| //Add an Input Event | |
| document.querySelector('#inp_answer').addEventListener('input', function() { | |
| checkAnswer(this); | |
| }); | |
| }) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment