I was making a quiz site and when I came to the point when I was making a button to show you the correct answer of your mistake I used document.getElementById but it always erased the rest of the answers that was written by the same method.
here is a snippet of my javascript code
if (mistakes > 0) {
if (document.getElementById('wrongAnswer1').checked === true ||
document.getElementById('wrongAnswer2').checked === true) {
document.getElementById('mistakesDiv').innerHTML =
document.getElementById('mistakesDiv').innerHTML +
"<br>" +
"question 1's correct answer is" +
document.getElementById('correctAnswer1').value;
}
}