Default text in a response that disappears when clicked on | XM Community
Solved

Default text in a response that disappears when clicked on



Show first post

37 replies

Userlevel 7
Badge +27

The url is an image you upload to your Qualtrics library. After you upload it, copy the url into your CSS.

Getting back to the original question, I have a series of 6 text boxes in a question and I need to add custom placeholder text that is different for each box. I have used the code noted above but it still only places the same set of text in each box. I am not sure how I can tell the script to place a specific text string in a specific text box... Any help is welcome!
Thanks

Userlevel 7
Badge +27

https://www.qualtrics.com/community/discussion/comment/27600#Comment_27600You could do this:
var ph = ["ph1","ph2","ph3","ph4","ph5","ph6"];
jQuery("#"+this.questionId+" .InputText").each(function(i) {
jQuery(this).attr("placeholder", ph[i]);
});

THAT'S IT! Took a sec to realize the ph"x" corresponded to the text in each placeholder field but it works perfectly!

Hi TomG I am trying to make a default choice in a constant sum matrix table have a default choice equal to zero and have the 0 disappear when respondents click on the boxes to enter a number. I tried using the code below in addonload but it's not working. The table could also be text matrix if needed. Would you know how I can do this? Thank you in advance!


jQuery("#"+this.questionId+" .InputText").each(function() {
jQuery(this).attr("placeholder", "My placeholder text");
});

Userlevel 7
Badge +27

https://www.qualtrics.com/community/discussion/comment/29203#Comment_29203The "0" in a constant sum isn't a placeholder, it is the initial default value. If a field has a value (i.e., is non-blank) the placeholder won't display.
You don't need a placeholder. I think you want:
Qualtrics.SurveyEngine.addOnload(function() {
jQuery("#"+this.questionId+" .SumInput .InputText").focus(function() {
if(this.value == "0") this.value="";
});
});

https://www.qualtrics.com/community/discussion/comment/29204#Comment_29204Right, thanks for pointing out the difference! The code you provided is not making the default choices (0) disappear when you click on the box. Any ideas of something else I can try?

Userlevel 7
Badge +27

https://www.qualtrics.com/community/discussion/comment/29210#Comment_29210The code provided works on a Constant Sum question. For a constant sum matrix change it to:
Qualtrics.SurveyEngine.addOnload(function() {
jQuery("#"+this.questionId+" td:not(.CSTotal) input[type=text]").focus(function() {
if(this.value == "0") this.value="";
});
});

Thank you!

Userlevel 1
Badge +8

Thanks. This is exactly what i need. But we use different languages of th esurvey (dutch, french & english). Could this also be used linguistically?

Userlevel 7
Badge +27

https://community.qualtrics.com/XMcommunity/discussion/comment/42468#Comment_42468Yes, pipe the placeholder text into the JS from a translated question.

Userlevel 1
Badge +8

I used this in my survey and works perfect :-)
Qualtrics.SurveyEngine.addOnload(function()
{
if( "${e://Field/Q_Language}" =="NL") //Check which language is selected
 {  
jQuery("#"+this.questionId+" .InputText").attr("placeholder", "Door ons uw feedback te geven, kunt u ons helpen deze pagina te verbeteren. Uw feedback zal anoniem worden verwerkt.");
 } 

 if( "${e://Field/Q_Language}" =="EN") //Check which language is selected
 {  
jQuery("#"+this.questionId+" .InputText").attr("placeholder", "By giving us your feedback, you can help us improve this page. Your feedback will be processed anonymously.");
}

if( "${e://Field/Q_Language}" =="FR") //Check which language is selected
 {  
jQuery("#"+this.questionId+" .InputText").attr("placeholder", "En nous donnant votre avis, vous pouvez nous aider à améliorer cette page. Vos commentaires seront traités de manière anonyme.");
}
}
);

Leave a Reply