Created
July 11, 2018 12:47
-
-
Save mattbloomfield/e45da612305ea62ff88dc336f151436f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Qualtrics.SurveyEngine.addOnload(function() { | |
// may need to modify these | |
var pickGroupQID = 'QID5'; // this is the qid of the Pick, Group, and Rank question | |
var numberOfGroups = 3; // how many groups do you have? | |
// add listeners to text boxes | |
for (var i = 1; i < numberOfGroups + 1; i++) { | |
var selector1 = '#' + this.questionId + ' .ChoiceStructure table tr:nth-child(' + i + ') input'; | |
// store the group number for recall within event handler | |
jQuery(selector1).attr('group-number', i); | |
jQuery(selector1).on('blur', function() { | |
// Find the correct group header | |
var selector2 = '#' + pickGroupQID + ' .groupsContainerTd .Group:nth-child(' + jQuery(this).attr('group-number') + ') h2'; | |
// Find the value typed in textbox | |
var value = jQuery(this).val(); | |
// populate value | |
jQuery(selector2).html(value); | |
}); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment