Keep Two Answer Options Together When Randomizing Options

When randomizing answer options customers often wish to keep to options together. That is, they wish for the options to randomly move about in the list of all answer options, however, they want them to remain together as a group. While we don't have a built-in feature for this you can set this up with a little snippet of JavaScript code. 

Check it out in an example survey!


Download this example survey to your account!


To get started, create your list of answer options and set them to be randomized. Next, on the same page, add a JavaScript Action and paste the below code. Change the highlighted text of the script to read exactly like your answer options (case sensitive). 

  var firstOption = $("li:contains('Keep this together 1')");
  var secondOption = $("li:contains('Keep this together 2')");

Finally, test your survey to ensure that the options are being kept together!

Scripting and Other Custom Solutions

We’re always happy to help you debug any documented script that is used as is. That said, we do not have the resources to write scripts on demand or to debug a customized script.

If you have customization ideas that you haven't figured out how to tackle, we're happy to be a sounding board for SurveyGizmo features and functionality ideas that might meet your needs. Beyond this, check out our Professional Services; these folks have the scripting chops to help you to achieve what you are looking for!

Basic Standard Market Research HR Professional Full Access Reporting
Free Individual Team & Enterprise
Feature Included In