Thomas Gibbons Consulting Qualtrics Wiki

Contact TomG on Qualtrics Community

User Tools

Site Tools


mccgaccordion

mcCgAccordion - Expand and collapse choice groups in a multiple choice question

The mcCgAccordion function expands and collapses choice groups in a multiple choice question. It automatically adjusts behavior for single and multi-select choice groups.

Here is a quick video demonstration:

Features include:

This function is available for a reasonable fee. Contact TomG on the Qualtrics Community to learn more.

Set-up Instructions

Survey Header

Add the mcCgAccordion function to the survey header to make it available to any question in the survey. Go to Look & Feel → General → Header edit → and paste the provided mcCgAccordion function JS:

<script>/*Paste mcCgAccordion function JS here*/</script>

Alternatively, paste the mcCgAccordion function JS into a question's JS outside the existing Qualtrics functions to make it available to questions on the page.

Question Setup

Question Options

The requirements for the multiple choice question are:

  • Format: List
  • Alignment: Vertical

Choice Groups

Create choice groups and assign choices to the groups. Do NOT hide the choice group titles. Set other choice group options as needed.

Question JavaScript

Add JS to call the mcCgAccordion function to apply it to the multiple choice question as follows:

Qualtrics.SurveyEngine.addOnload(function() {
	mcCgAccordion(this);
});

To override the default options, specify the desired options is the second function argument as an object. For example:

Qualtrics.SurveyEngine.addOnload(function() {
	mcCgAccordion(this,{start:"expand"});
});

Options

collapseText

collapseText is a string that specifies the text display to the right of the choice group label when a choice group is expanded.

Default: '^'

expandText

expandText is a string that specifies the text displayed to the right of the choice group label when a choice group is collapsed.

Default: '˅'

start

start is a string that specifies the start mode of the choice groups. There are three valid values:

  1. auto - expand the first unanswered choice group and collapse the others
  2. collapse - collapse all choice groups
  3. expand - expand all choice groups

Default: 'auto'

Qualtrics Wiki

mccgaccordion.txt · Last modified: 2023/10/08 12:49 by admin

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki