Solved
How to count # of items dragged & dropped into a box
Hi. I have a question where there are 10 choices and they can be dragged or dropped into one of two boxes, or not. I need to be able to count how many are in one of the boxes because that number will be used later in the survey in a calculation. I can't seem to come up with an easy way to do it. Any help on this appreciated!
Best answer by Anonymous
Hello @Tom_R,
I hope you are using Pick, group, Rank question
Step 1: Add two embedded data (eg: Group1Count, Group2Count ) in the survey flow before the Pick, group, Rank question
Step 2: Add the following js in the `js(OnUnload)` of the pick group rank question
var group1count=jQuery("#" +this.questionId+"group0 li").length;
var group2count=jQuery("#" +this.questionId+"group1 li").length;
Qualtrics.SurveyEngine.setEmbeddedData( 'Group1Count', group1count );
Qualtrics.SurveyEngine.setEmbeddedData( 'Group2Count', group2count );
Step3: Use the embedded data (eg: Group1Count, Group2Count ) wherever required in the survey
View originalLeave a Reply
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.