Adding background text to Text Entry question | XM Community
Skip to main content

Hello

 

I’d like to replicate adding the greyed out text into the nan-mandatory text entry questions? Can anyone help?

 

 

Add a placeholder attribute to the text entry element:

Qualtrics.SurveyEngine.addOnload(function() {
jQuery("#"+this.questionId+" .InputText").attr("placeholder","background text goes here");
});

Note: jQuery selector would be different for Simple layout.


hi @TomG , thanks for the solution. I am not very technical minded, would you mind helping me a bit further?

AM I adding the above script into the JavaScript section? basically replace the circled part with your script? and which elements of the script I need to personalise? replace questionId with QID23_TEXT ? and anything else?

 


@AnnaP,

Yes, you’ll update the JavaScript section. Just replace everything that is there with the code I provided. The only customization needed is replacing "background text goes here" with the placeholder text you want in your text input field.


hi @TomG 

it’s not working. I tried this:

Qualtrics.SurveyEngine.addOnload(function()
{
    jQuery("#"+this.questionId+".InputText").attr("placeholder","background text goes here");

});

Qualtrics.SurveyEngine.addOnReady(function()
{
    /*Place your JavaScript here to run when the page is fully displayed*/

});

Qualtrics.SurveyEngine.addOnUnload(function()
{
    /*Place your JavaScript here to run when the page is unloaded*/

});

 

and tried this:

Qualtrics.SurveyEngine.addOnload(function()
{
    jQuery("#"+this.questionId+".InputText").attr("placeholder","background text goes here");

});

 

I do not see any background text


@AnnaP - You are missing a space before .InputText.


Hi @TomG, I’ve got it. It’s now showing in the preview. Should it be showing in the survey builder as well?

Also another question. What would I have to do to change font colour. I am thinking lighter grey.

 


Leave a Reply