How to cause last accordion in mobile friendly matrix to auto close upon answer selection? | XM Community
Skip to main content

I am working on a mobile friendly accordion style matrix question and the UI for the first 3 statement options auto collapses the accordion to show the next statement. How do I achieve the same effect for the 4th and final statement before the user would continue to the next question?
image.png

Hi Jared, Try adding this JavaScript code in that question.
Qualtrics.SurveyEngine.addOnReady(function () {
    var $this = jQuery(this.questionContainer);
    var isMobile = jQuery(".QuestionBody", $this).is(".mobile");
    jQuery(".ChoiceRow input id]uname]", $this).on("change", function () {
        if (isMobile && jQuery(this).closest(".ChoiceRow").nextAll(".ChoiceRow").length === 0) {
            jQuery(this).closest(".ChoiceRow").find("thcid]").click();
        }
    });
});


Thank you! This worked like a charm!


Leave a Reply