Fix explanation letter prefix after answer shuffle
After shuffleQuestion() reorders answers, the hardcoded A–D prefix in each explanation text no longer matched the displayed option letter. Replace the leading letter dynamically based on the shuffled position. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
ea9a60e5aa
commit
2210ef4623
1 changed files with 3 additions and 1 deletions
|
|
@ -172,7 +172,9 @@ function handleAnswer(chosen) {
|
||||||
expDiv.innerHTML =
|
expDiv.innerHTML =
|
||||||
'<div class="explanation-source">Proefexamen ' + q.exam + ', vraag ' + q.qnum + '</div>' +
|
'<div class="explanation-source">Proefexamen ' + q.exam + ', vraag ' + q.qnum + '</div>' +
|
||||||
'<div class="explanation-label">Toelichting</div>' +
|
'<div class="explanation-label">Toelichting</div>' +
|
||||||
q.explanation.map(e => '<p>' + e + '</p>').join('');
|
q.explanation.map((e, i) =>
|
||||||
|
'<p>' + e.replace(/^[A-D]\.\s*/, 'ABCD'[i] + '. ') + '</p>'
|
||||||
|
).join('');
|
||||||
|
|
||||||
const nextBtn = document.getElementById('next-btn');
|
const nextBtn = document.getElementById('next-btn');
|
||||||
nextBtn.style.display = 'inline-flex';
|
nextBtn.style.display = 'inline-flex';
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue