How might I correctly apply multiple expandable buttons to the same block/question? | XM Community
Skip to main content

Hello, I am attempting to provide a method of hiding additional information about the survey in expandable/collapsable buttons to be better presented for the participants.
My method so far of utilising JS and HTML has been through his old thread:
https://community.qualtrics.com/XMcommunity/discussion/comment/27997#Comment_27997
Among the comments is a precise JS and HTML by TomG.
This is JS:
jQuery("#button").click(function() {
jQuery("#infodiv").toggle();
});
And the HTML:



The JS & HTML has been successful when a single expandable button is present within the question/block. However, when attempting to produce multiple of these said buttons on the same Question/Block it will only permit the first one to open.
Any assistance with this would be greatly appreciated!
I apologise for how simple this question might sound, and if this has already been asked before.

Hi there,
It looks like since you're copying this for multiple buttons, since you're always referring to the same id, it will only open that first one. You should be able to fix this by giving each button a unique name (button2, button3, etc.). If you change that name in both the JS and HTML, it should work. (Just make sure to do the same for your div as well.)


Leave a Reply