Hi everyone!
I'm trying to have a pop-up message on the screen upon selection of a particular answer for a multiple-choice question.
I'm trying to see if I can change participants' responses after the warning message, so it is important to record their first choices and whether they changed their minds or not.
If choice #1 is selected, I need a pop message to show on the screen at the moment the participant select that choice.
I need Qualtrics to record the response they selected that caused the pop up to appear, and
I need to provide an opportunity for participants to change their choices after seeing the pop up message.
I need that both the first choice and second choice to be recorded.
I tried this:
var that = this;
var msg = 'INSERT ERROR TEXT HERE';
jQuery("#NextButton").on('click',function(){
var correctrecode = 8;
var choiceid = jQuery("#"+that.questionId+" input[type='radio']:checked").attr("choiceid");
var selectedrecode = that.getChoiceRecodeValue ( choiceid );
if(correctrecode==selectedrecode){
alert(msg);
}
});
Unfortunately, this is not what I need because it does not provide a chance for participants to change their choices.
Also, I would like the pop message to show up in the middle of the screen, not at the top.
Any help will be appreciated. My JavaScript knowledge is very limited.
Thank you!
Angélica
Solved
display a pop message on screen when a particular response is given

Best answer by ahmedA
Try this JS:
Qualtrics.SurveyEngine.addOnReady(function () {
let relevant_choice = this.questionContainer.querySelectorAll("li")[0];
relevant_choice.onclick = function (click) {
let recall = confirm("Do you really want to share?");
if (!recall) click.preventDefault();
};
});
You may have to change the 0 to 1 based on your arrangement.
Leave a Reply
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.