Am working on a quiz where i need an image to show good or bad when i click submit, if the correct or wrong answers are chosen. But i keep getting only one image displayed.
HTML
<div class = "question1">
<p>What is the capital of Nigeria?</p>
<input type = "text" id = "question_one">
<div id = "goodorbad"></div>
</div>
<div class = "question2">
<p>Which of these is the symbol for 'plus'?</p>
<select id = "operators">
<option value = "x">x</option>
<option value = "-">-</option>
<option value = "+">+</option>
<option value = "%">%</option>
</select>
<div id = "goodorbad"></div>
</div>
JAVASCRIPT
function getResult() {
let answer_one = document.getElementById("question_one").value;
let answer_two = document.getElementById("operators").value;
let correct_ans = 0;
if (answer_one === "abuja") {
correct_ans++;
}
if (answer_two === "+") {
correct_ans++;
}
let sign_symbol = ["bad1.png" , "good1.png"];
let sign;
if (correct_ans === true){
sign = 1;
}
else{
sign = 0;
}
document.getElementById("goodorbad").src = sign_symbol[sign];
If an answer is correct, then the good1.png image should display at the right hand corner and if an answer is incorrect, the bad1.png image should display
getResult()and how are you sending the form?