Multiple-chocie question with text entry | XM Community
Question

Multiple-chocie question with text entry

  • 28 July 2020
  • 1 reply
  • 31 views

Hello
I would like to a have multiple-choice question with the following answer possibilities:
a) Yes
b) No
c) Other
If the user checks c) then there should be a text field where he has to write something (characters).
Is this possible and if yes, how?


1 reply

Userlevel 5
Badge +4

Hi,
You can use the below JS code to display or hide the text field based on the selection of other option,
Qualtrics.SurveyEngine.addOnReady(function()
{
jQuery('input[type="text"]').css('display','none')
this.questionclick = function(event,element)
{
        if (element.type == 'radio')
        {
            var choiceNum = element.id.split('~')[2];
             if (choiceNum == 3)
            {
                jQuery('input[type="text"]').css('display','inline')
            }
            else
            {
                jQuery('input[type="text"]').css('display','none')
            }
        }
}

});

Leave a Reply