Can you reset / undo the ranking of a ranking question | Experience Community
Skip to main content
Question

Can you reset / undo the ranking of a ranking question

  • February 4, 2026
  • 1 reply
  • 6 views

Forum|alt.badge.img+11

Hi All,

 

I have a ranking question (in classic theme, ie not the new simple theme), using choices from a previous question but hopefully that doesn’t matter..  I would like to know if it’s possible to undo / unset the ranking in case someone accidentally touches / drags one of the items but actually didn’t want to answer the question.

 

If there a way of doing this in code?

 

I’ve played around a bit getting a button setup but I’m not sure what the next steps would be.

 

Thanks

 

Rod Pestell  

1 reply

vgayraud
QPN Level 7 ●●●●●●●
Forum|alt.badge.img+61
  • QPN Level 7 ●●●●●●●
  • February 4, 2026

Hi,

Add a click listener to your button and use the setChoiceValue method to reset them to “”. You would also need to reset the ul element to clear the ranks visually.

Something like this should work in classic layout:

Qualtrics.SurveyEngine.addOnReady(function () {

var thisQuestion = this;
var qContainer = thisQuestion.getQuestionContainer();

var resetBtn = document.createElement("button");
resetBtn.type = "button";
resetBtn.textContent = "Reset Rankings";
resetBtn.style.marginTop = "10px";
resetBtn.style.padding = "5px 10px";
resetBtn.style.cursor = "pointer";
qContainer.appendChild(resetBtn);

resetBtn.addEventListener("click", function () {
var choices = thisQuestion.getChoices();
choices.forEach(function (choiceId) {
thisQuestion.setChoiceValue(choiceId, "");
});
var roList = qContainer.querySelector("ul[id$='~RO']");
if (roList) {
roList.classList.remove("Edited");
if (!roList.classList.contains("NotEdited")) {
roList.classList.add("NotEdited");
}
}
});

});