Text input placeholders not showing up on second page of form | XM Community
Skip to main content

I tried to add the placeholders to a text input in multiple ways with Javascript. In the survey footer. In the individual question javascript.

Qualtrics.SurveyEngine.addOnReady(function()
{
/*Place your JavaScript here to run when the page is fully displayed*/
jQuery("#" + this.questionId).find(".QuestionBody").prepend("

Enter your email address.

");
jQuery(".QR-QID24").attr("placeholder","EmailAddress");
});

It's showing up in the inspector
placeholder.PNG
But it's not showing up.

However text inputs on the first page display. Also, textarea placeholders show up on the second page.
place2.PNG


I'm very confused. Any help would be appreciated. Thanks!


** UPDATE **
I was able to determine that this is part of the issue
jQuery("#" + this.questionId).find(".QuestionBody").prepend("

Enter your email address.

");

** UPDATE 2 **
For whatever reason moving that label up one branch in the DOM allows the placeholder to diplsay again

jQuery("#"+this.questionId+" .QuestionBody").before("

Enter your email address.

");

If you have more than one text box on the page then assign the placeholder text using the index of text box.
This will assign the placeholder text for the first 3 boxes,
Qualtrics.SurveyEngine.addOnReady(function()
{
jQuery("#"+this.questionId+" input[type='text']").eq(0).attr("placeholder", "Text 1");
jQuery("#"+this.questionId+" input[type='text']").eq(1).attr("placeholder", "Text 2");
jQuery("#"+this.questionId+" input[type='text']").eq(2).attr("placeholder", "Text 3");
});


Leave a Reply