How do I disable the next button until the last carousel question is answered? | XM Community
Skip to main content

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

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*/

});

 


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


great, good luck @MadhurSingh !


Leave a Reply