How do I disable the next button until the last carousel question is answered? | XM Community
Solved

How do I disable the next button until the last carousel question is answered?

  • 12 March 2024
  • 3 replies
  • 60 views

Badge +6

@ArunDubey

I was looking for Java script to hide the next button untill last answer provided in a multiselect Carousel and Carousel card options are caaryforwarded from last multiselect Question (maximum 9 and minimum 1).

Request you to please help to share JS code for this requirement.

Thank you so much for your help in advance.

icon

Best answer by ArunDubey 12 March 2024, 09:33

View original

3 replies

Userlevel 7
Badge +33

Hi @MadhurSingh ,

I’m understanding it correctly, you want to hide forward button till last card of carousel. Please refer below solution and js code and let me know if it works for you.



So Q1 is multi select:
 


and Q2 is carousel grid question:
 

 

Paste below jQuery code on Q2: Replace QID1 with Q1 id of your survey.

Try this and let me know if it’s working.

Qualtrics.SurveyEngine.addOnload(function()
{
/*Place your JavaScript here to run when the page loads*/
setTimeout(function(){
var Q1x='${q://QID1/SelectedChoicesRecode}';
var count=Q1x.split(',').length;

if(count>1 && jQuery(".CarouselCard").last().hasClass("NoDisplay")){
jQuery("#NextButton").hide();
}
},30);

});

Qualtrics.SurveyEngine.addOnReady(function()
{
/*Place your JavaScript here to run when the page is fully displayed*/
jQuery(".CarouselCardRightContainer").click(function(){
if(!jQuery(".CarouselCard").last().hasClass("NoDisplay")){

jQuery("#NextButton").show();
}
});
});

Qualtrics.SurveyEngine.addOnUnload(function()
{
/*Place your JavaScript here to run when the page is unloaded*/

});

 

Badge +6

@ArunDubey  Thank you so much for your prompt response. It’s absolutely working fine. Thanks a ton !

Userlevel 7
Badge +33

great, good luck @MadhurSingh !

Leave a Reply