I'm working on developing a quiz application and I'm facing an issue where my quiz is skipping question 2 when moving from one question to the next using the "next" button. I have a total of 3 questions in my quiz and for some reason, it jumps from question 1 to question 3 without displaying question 2. I would greatly appreciate any assistance or tips on how to fix this problem. You can view my code on CodePen via the following link: https://codepen.io/Michaelm4100/pen/GRQxNQO?editors=1011
// Function to toggle active-question class for each question
function activeQuestion(el) {
var que = document.getElementsByClassName('question');
for (var questions of que) {
// console.log(questions)
// Remove active-question class
questions.classList.remove('active-question');
}
questions.classList.add('active-question');
}
var nextButton = document.getElementsByClassName('nxt-btn');
for (var buttons of nextButton)
buttons.addEventListener('click', function(e){
// Call the active Question function on button click event
activeQuestion(e);
})
}