A popup shows up the text of Unselected options | XM Community

A popup shows up the text of Unselected options

  • 19 January 2020
  • 1 reply
  • 11 views

Badge
Hi guys, for some reason I need to inform the subjects that they did not select the other option in a question of two options.

For example, the question is

Which animal do you like?
1. Cats
2. Dogs

Say, if one select 1. Cats. then an alert pops up that says "You don't like Dogs?"

I am trying by googling this myself and it works with a single click function

Qualtrics.SurveyEngine.addOnload(function()
{
this.questionclick = function(event, element) {
if (element.type == 'radio')
{
if (this.getChoiceValue()==2){
var choice= this.getChoiceVariableName(1);}
if (this.getChoiceValue()==1){
var choice = this.getChoiceVariableName(2);}
var r = confirm("Reminder: This is the your choice "+choice); //design your question here
if (r == true) {
that.clickNextButton();
} else {

}
}
}

});


However, I need combine this with doubleclicking to the next page, then it does not work.

Qualtrics.SurveyEngine.addOnload(function() {

this.hideNextButton();
var that = this;
jQuery('.LabelWrapper').dblclick(function() {

if (this.getChoiceValue()==2){
var choice= this.getChoiceVariableName(1);}
if (this.getChoiceValue()==1){
var choice = this.getChoiceVariableName(2);}

var r = confirm("Reminder: This is the your choice "+choice); //design your question here
if (r == true) {
that.clickNextButton();
} else {

}


});



I highly appreciate any help that I can get.

Thank you everyone!

1 reply

Userlevel 7
Badge +30
Hi @Rui ,

I don't know Javascript well enough to troubleshoot this code or how it works in Qualtrics. But I'm wondering if Javacript has to be used at all? Is it a requirement that the "You don't like dogs/cats" messages be pop-up alerts? Or could you get by with using putting those messages in a Descriptive Text object and using Display Logic to show them to the respondent?

Leave a Reply