Hi Community,
I'm trying to work with can add a reset/clear option to the survey that would like to clear their selections for the current question, they can simply press a reset/clear button and it would delete all the responses for that question at once
How to add reset button in the Question
ricsdpl
This would be quite difficult as for each question type a different JS would be needed it would make it more complicated.
My suggestion would be to don't go ahead with it as if at all you create that button and in future you change the question type you will have to change the button as well.
Hope it helps!
This should work for most questions:
Qualtrics.SurveyEngine.addOnReady(function () {
const quest = this;
const qc = quest.questionContainer;
qc.querySelector(".QuestionText").insertAdjacentHTML("afterend", "");
qc.querySelector(".reset").onclick = function () {
qc.querySelectorAll(".q-checked").forEach((item) => {
item.classList.remove("q-checked");
});
qc.querySelectorAll("select").forEach((item) => {
item.clear();
});
qc.querySelectorAll(".InputText").forEach((item) => {
item.value = "";
});
};
});
Leave a Reply
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.