MCPcopy Create free account
hub / github.com/Vishal-raj-1/Awesome-JavaScript-Projects / submitAnswer

Function submitAnswer

assets/js/math_trainer.js:3–24  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1 var res = "question not found";
2
3 function submitAnswer(){
4 // console.log(res);
5
6 document.querySelector("#answerBox").innerHTML = "";
7
8 var userInputVal = document.querySelector("#userInput");
9 var warningMsg = document.querySelector("#warning");
10
11 // console.log(userInputVal.value);
12 if (!userInputVal.value) {
13 warningMsg.innerHTML = "PLEASE ENTER YOUR ANSWER OR GO TO NEXT QUESTION ";
14 }
15 else if (userInputVal.value == res) {
16 warningMsg.innerHTML = "WELL DONE! GO TO NEXT QUESTION";
17 document.getElementById("warning").style.color = "green";
18 // console.log("well done");
19 }
20 else {
21 warningMsg.innerHTML = "WRONG ANSWER TRY AGAIN";
22 document.getElementById("warning").style.color = "red";
23 }
24 }
25
26 function nextQues(){
27

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected