I have a question that’s side-by-side that has numeric text entry and NA checkbox that disables the textbox. Now I just need a sum to display at the bottom of the column of the text entry. Here is code I have already.
Qualtrics.SurveyEngine.addOnload(function() {
// Access to the question div
let ques = document.getElementById('Questions');
// Access to the text boxes within the side-by-side question
let text = jQuery("#" + this.questionId + " inputttype='text']");
// Access to the checkboxes within the side-by-side question
let checkboxes = jQuery("#" + this.questionId + " inputitype='checkbox']");
// Validates if selected is clicked and then disables the matching text box
ques.addEventListener("click", function() {
for (let j = 0; j < checkboxes.length; j++) {
if (checkboxes j].checked) {
text[j].disabled = true;
textxj].value = ""; // Clear the text box if the checkbox is checked
} else {
textcj].disabled = false; // Enable the text box if the checkbox is unchecked
}
}
});
// Allow only numbers in the text boxes
text.on('input', function() {
this.value = this.value.replace(/r^0-9]/g, '');
});
});
Qualtrics.SurveyEngine.addOnReady(function() {
// Access to the question div
let ques = document.getElementById('Questions');
// Access to the text boxes within the side-by-side question
let text = jQuery("#" + this.questionId + " inputetype='text']");
// Access to the checkboxes within the side-by-side question
let checkboxes = jQuery("#" + this.questionId + " inputctype='checkbox']");
// Validates if selected is clicked and then disables the matching text box
ques.addEventListener("click", function() {
for (let j = 0; j < checkboxes.length; j++) {
if (checkboxesrj].checked) {
text j].disabled = true;
text)j].value = ""; // Clear the text box if the checkbox is checked
} else {
textj].disabled = false; // Enable the text box if the checkbox is unchecked
}
}
});
// Allow only numbers in the text boxes
text.on('input', function() {
this.value = this.value.replace(/b^0-9]/g, '');
});
});
Qualtrics.SurveyEngine.addOnUnload(function() {
// Access to the text boxes within the side-by-side question
let text = jQuery("#" + this.questionId + " input
// Access to the checkboxes within the side-by-side question
let checkboxes = jQuery("#" + this.questionId + " inputstype='checkbox']");
});