Skip to content

Commit 5cfa656

Browse files
ShortAnswer: preserve event handlers when building
1 parent 67e6d21 commit 5cfa656

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

bases/rsptx/interactives/runestone/shortanswer/js/shortanswer.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,10 @@ export default class ShortAnswer extends RunestoneBase {
6161
this.fieldSet = document.createElement("fieldset");
6262
this.newForm.appendChild(this.fieldSet);
6363
this.firstLegendDiv = document.createElement("div");
64-
this.firstLegendDiv.innerHTML = this.question;
64+
// move contents to new div, keeping any event listeners
65+
while (this.origElem.firstChild) {
66+
this.firstLegendDiv.appendChild(this.origElem.firstChild);
67+
}
6568
this.firstLegendDiv.classList.add("journal-question");
6669
this.firstLegendDiv.classList.add("exercise-statement");
6770
this.fieldSet.appendChild(this.firstLegendDiv);

0 commit comments

Comments
 (0)