Skip to content

Commit

Permalink
Clone atable before coloring the qtable
Browse files Browse the repository at this point in the history
  • Loading branch information
zjosua committed Oct 31, 2022
1 parent 48a8f67 commit 09a73cb
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions src/multiple_choice/card/back.html
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,16 @@
var qtable = document.getElementById('qtable');
qtable.innerHTML = Persistence.getItem('qtable');

// Clone atable from qtable before colorizing the qtable
if (OPTIONS.atable.visible) {
var output = document.getElementById("output");
var atable = qtable.cloneNode(true);
atable.setAttribute("id", "atable");
output.innerHTML = "<hr id='answer' />" + atable.outerHTML;

var arows = document.getElementById("atable").getElementsByTagName("tbody")[0].getElementsByTagName("tr");
}

if (OPTIONS.qtable.visible) {
var qrows = qtable.getElementsByTagName('tbody')[0].getElementsByTagName("tr");
for (let i = 0; i < answers.length; i++) {
Expand All @@ -103,14 +113,6 @@
}
} else qtable.innerHTML = ""

if (OPTIONS.atable.visible) {
var output = document.getElementById("output");
var atable = qtable.cloneNode(true);
atable.setAttribute("id", "atable");
output.innerHTML = "<hr id='answer' />" + atable.outerHTML;

var arows = document.getElementById("atable").getElementsByTagName("tbody")[0].getElementsByTagName("tr");
}
var canswers = 0;
for (let i = 0; i < solutions.length; i++) {
if (OPTIONS.atable.visible) {
Expand Down

0 comments on commit 09a73cb

Please sign in to comment.