New layout view -- accordian does not auto-close after response | XM Community
Question

New layout view -- accordian does not auto-close after response

  • 25 April 2024
  • 2 replies
  • 15 views

Badge +3

Does anyone know how to auto-close matrix, accordian-style questions in the new layout view? (There doesn’t seem to be a th[id] element.)

Thanks for any ideas!


2 replies

Userlevel 4
Badge +8

Hi @Chipper ,

In Qualtrics, the new layout view might not have a straightforward way to auto-close matrix questions with accordion-style formatting. You can give a try with JavaScript

//JavaScript//

Qualtrics.SurveyEngine.addOnload(function() {
    // Function to collapse all matrix questions initially
    function collapseMatrixQuestions() {
        var matrixQuestions = document.querySelectorAll('.MatrixQuestion');
        matrixQuestions.forEach(function(question) {
            var accordionToggle = question.querySelector('.AccordionContent');
            if (accordionToggle) {
                accordionToggle.click(); // Simulate a click on the accordion toggle to collapse the question
            }
        });
    }

    // Call the function to collapse matrix questions on page load
    collapseMatrixQuestions();
});

 

Thank you!

Badge +3

Hi, @Nanditha MM,

Thanks so much for providing the script! Unfortunately, I think there’s something in this style that prevents your and my scripts from working.

I am grateful for your generosity!

 

Leave a Reply