Skip to content

Commit 7962bce

Browse files
committed
Clear previous option styles before displaying new problem options
1 parent 7b7e9de commit 7962bce

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

addition-subtraction-0-20.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -308,6 +308,15 @@ function displayProblem(problemData) {
308308
currentProblemData = problemData;
309309

310310
problemTextElement.textContent = currentProblemData.questionText;
311+
312+
// Explicitly clear styles/classes from old options before removing them
313+
const oldOptions = optionsContainer.querySelectorAll('.option');
314+
oldOptions.forEach(option => {
315+
option.classList.remove('correct', 'wrong');
316+
option.style.transform = 'none'; // Remove inline transform if any
317+
option.disabled = false; // Re-enable just in case
318+
});
319+
311320
optionsContainer.innerHTML = ''; // Clear previous options
312321

313322
currentProblemData.options.forEach((optionValue) => {

0 commit comments

Comments
 (0)