Ending a block upon selecting in multiple choice | XM Community
Skip to main content
I want the block to end once participants choose one of the multiple choices. I came up with the following code "my knowledge with Java is so poor":

Qualtrics.SurveyEngine.addOnload(function()
{
$(this.questionId).select('checked')==true.first().observe('click', function(event) {
$('NextButton').click();
});
});
Qualtrics.SurveyEngine.addOnReady(function()
{
jQuery("[type='checkbox']").change(function(){
if(jQuery(this).prop("checked") == true){
('NextButton').click();
}
});
});

Still, it does not work. Any help, please
Hello @ahmezon ,

Use skip logic on MC question and select end of block
Dear @Shashi

Thank you. Skip logic works only after the next button is clicked. I want to bypass that. We are measuring the response time. We need the block to terminate once a choice is made.
You can use a function like this added to the OnLoad:

this.questionclick = function(event,element)
{
$('NextButton').click();
}

This assumes that you want all answers to automatically end the block. You can put conditional logic in also to click the next button when a specific choice is clicked.
Dear @WaterSampler,

Thank you so much. I figured this out, and it works.

Qualtrics.SurveyEngine.addOnload(function()
{
$('Buttons').hide();
var that = this;
this.questionclick = function(event,element){
if (element.type == 'radio') {
that.clickNextButton();
}
}


});

Leave a Reply