-
Notifications
You must be signed in to change notification settings - Fork 0
/
secondUnlike.js
38 lines (34 loc) · 1.27 KB
/
secondUnlike.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
//For the second fraction that the user must input
var answerNumTwo = document.getElementById("answerNumTwoUnlike")
var answerDenTwo = document.getElementById("answerDenTwoUnlike")
var numTwoError = document.getElementById("numTwoErrorUnlike")
var denTwoError = document.getElementById("denTwoErrorUnlike")
answerNumTwo.addEventListener("input", function(e) {
var answer = answerNumTwo.value;
if (answer != 3){
answerNumTwo.setAttribute("style", "background-color:red");
numTwoError.setAttribute("style", "visibility:visible");
console.log("you suck");
}
else{
answerNumTwo.setAttribute("style", "background-color:green");
numTwoError.setAttribute("style", "visibility:hidden");
console.log("you rock!");
}
}, false);
answerDenTwo.addEventListener("input", function(e) {
var answer = answerDenTwo.value;
if (answer != 6){
answerDenTwo.setAttribute("style", "background-color:red");
if (answer == 5){
console.log("Did you remember to find a common denominator?")
denTwoError.setAttribute("style", "visibility:visible");
}
console.log("you suck");
}
else{
answerDenTwo.setAttribute("style", "background-color:green");
denTwoError.setAttribute("style", "visibility:hidden");
console.log("you rock!");
}
}, false);