diff --git a/htdocs/js/MathQuill/mqeditor.js b/htdocs/js/MathQuill/mqeditor.js index 5b02d78e6..c2f589a3d 100644 --- a/htdocs/js/MathQuill/mqeditor.js +++ b/htdocs/js/MathQuill/mqeditor.js @@ -37,7 +37,9 @@ if (input.classList.contains('partially-correct')) answerQuill.classList.add('partially-correct'); // Find the feedback button for this input if there is one on the page. - const feedbackBtn = document.querySelector(`button[data-answer-label="${answerLabel}"`); + const feedbackBtn = Array.from(document.querySelectorAll(`button[data-answer-labels]`)).find((btn) => + JSON.parse(btn.dataset.answerLabels).includes(answerLabel) + ); // Default options. const cfgOptions = { diff --git a/macros/PG.pl b/macros/PG.pl index e3f4a8024..a689b6112 100644 --- a/macros/PG.pl +++ b/macros/PG.pl @@ -1222,7 +1222,7 @@ sub ENDDOCUMENT { } )->to_string ), - answer_label => $answerLabel, + answer_labels => JSON->new->encode($response_obj->{response_order}), bs_toggle => 'popover', bs_trigger => 'click', bs_placement => $showCorrectOnly ? 'right' : 'bottom',