Keep Two Answer Options Together When Randomizing Options

When randomizing answer options customers often wish to keep specific answer options together. While we don't have a built-in feature for this you achieve this with Radio Button and Checkbox questions with some JavaScript. 

Check it out in an example survey!

OR

Download this example survey to your account!

Setup

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). 

$(document).ready(function(){
  var firstOption = $("li:contains('Keep this together 1')");
  var secondOption = $("li:contains('Keep this together 2')");
  secondOption.detach();
  firstOption.after(secondOption);
});

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

Compatibility

This script is compatible with Radio Button and Checkbox questions.

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 Alchemer 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