How to show the NextButton when a certain chioce is selected | XM Community
Skip to main content

Hi everyone,
I came into a problem, very simple: A multiple choice question with two choices: A and B. When this question is displayed at the beginning (both choices are unselected), I want the NextButton to be hided, which is realized by the code "  $('NextButton').hide();". Furthermore, when choice A is selected, I would like the NextButton to be shown, while when choice B is selected, I would like the NextButton to stay hided.
Enclosed below is my drafted code, which can only realize hiding at the begining. Can anyone shown me what should I write for the whole functions? Really appreciate that! I have little coding experience so please feel free to help me out without hesitation!


Qualtrics.SurveyEngine.addOnReady(function()
{
  $('NextButton').hide();
var qobj = this;
jQuery("#"+this.questionId+" inputnchoiceid=1]").click(function() { qobj.showNextButton(); });
});

Use below code:
var next = jQuery("#NextButton");
   next.hide();
  jQuery("#"+this.questionId+" inputitype=radio]:eq(0)").click(function() { next.show(); });
  jQuery("#"+this.questionId+" input"type=radio]:eq(1)").click(function() { next.hide(); });


Wow, Rondev, it works! Many thanks!


Leave a Reply