Skip to content

Instantly share code, notes, and snippets.

@mattbloomfield
Created July 26, 2018 10:20
Show Gist options
  • Save mattbloomfield/ff4609bd60d697d1b1c7f617d046c8e1 to your computer and use it in GitHub Desktop.
Save mattbloomfield/ff4609bd60d697d1b1c7f617d046c8e1 to your computer and use it in GitHub Desktop.
/* This will work for any text entry except the forms */
Qualtrics.SurveyEngine.addOnload(function() {
var qid = this.questionId;
var placeholderText = 'I am different text';
jQuery('#' + qid + ' input[type="text"], #' + qid + ' textarea').attr('placeholder',placeholderText);
});
/*
This will work on a Form question (where there are multiple inputs)
You will need to copy this format if you have more than 3 text boxes
*/
Qualtrics.SurveyEngine.addOnload(function() {
var placeholder1 = 'my text';
var placeholder2 = 'my other text';
var placeholder3 = 'some more text';
// create more placeholder text variables as necessary and assign below
var qid = this.questionId;
// note that the index is different for each box. Because it's an array, the first input
// will be 0, the second, 1, and so on.
jQuery('#' + qid + ' .InputText')[0].setAttribute('placeholder',placeholder1);
jQuery('#' + qid + ' .InputText')[1].setAttribute('placeholder',placeholder2);
jQuery('#' + qid + ' .InputText')[2].setAttribute('placeholder',placeholder3);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment