Skip to content

Commit

Permalink
added add row button
Browse files Browse the repository at this point in the history
  • Loading branch information
tafakkur committed Jan 13, 2021
1 parent e4121ad commit 1076915
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions JavaScript Files/Add Row Button.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
Qualtrics.SurveyEngine.addOnReady(function () {
show_row = 3;
choice_rows = this.getChoiceContainer().querySelectorAll("[class*='Choice']");
choice_rows[choice_rows.length - 1].insertAdjacentHTML(
"afterend",
"<input type='button' id='row_adder' value='+' name='+' />"
);
for (i = show_row; i < choice_rows.length; i++) {
choice_rows[i].hide();
}
add_row = this.getChoiceContainer().querySelector("#row_adder");
add_row.onclick = new_row;

function new_row() {
if (show_row < choice_rows.length) {
choice_rows[show_row].show();
show_row++;
}
else{
alert("You've reached the maximum number of permissible rows");
}
}
});

0 comments on commit 1076915

Please sign in to comment.