getSelectedOptionIndex

Description

This function will help you to get the index of the answer option selected for a question by the respondents and use it within your script.


Syntax

$survey.getSelectedOptionIndex("Question Code")


Example Script

We can capture the option by index that is selected in the source questions(Q1) and by default select the same answer options under the follow up question.

arrow_rightScript

        var _index = $survey.getSelectedOptionIndex("Q1");
        $survey.setOptionSelected("Q2",_index);

                   

Example Survey: Survey Link


Supported Question Types

  • Multiple Choice: Select One
  • Multiple Choice: Select Many
  • Multiple Choice: Drop Down
  • Basic Matrix: Multi-Point Scales
  • Basic Matrix: Checkbox/Multi-Select
  • Image Chooser: Select One
  • Image Chooser: Select Many
  • Image Chooser: Select Rating
  • Graphical Rating: Thumbs Up/Down
  • Graphical Rating: Smiley - Rating
  • Graphical Rating: Text Slider
  • Graphical Rating: Numeric Slider
  • Customer Satisfaction: Net Promoter Score
  • Data Reference: Lookup Table

Need help? Contact Us