Js - Check If The Input Field Equals The Solution
I'm making a simple website for little kids with mathproblems, the page contains a number of questions that the kids need to solve. They can press on 1 button that checks if the va
Solution 1:
window.alert("try again);
needs to be window.alert("try again");
You forgot to place a quote
Solution 2:
You have to give an input box an unique ID. Then, you can obtain its value like this:
var value = document.getElementById("your-id").value;
Full code: http://jsfiddle.net/7uwNn/
Good luck with your project!
Solution 3:
Took me a minute to realise you had simply not completed your quotes on the window alert "try again"
functionquestion1() {
if (value == 32) {
window.alert("Correct!");
} else {
window.alert("Try again")
}
}
Post a Comment for "Js - Check If The Input Field Equals The Solution"