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

Badge +1
@TMartin53 did you get an answer to this? I have the same question.
Hi,

Can I apply this same coding to a multiple choice question with an "other" option with text entry? Screenshot is attached below.
Badge +2
@TomG that works beautifully, thank you!!!
Userlevel 7
Badge +27
> @EllenW said:
> @TomG , thank you for the code. I'm still at an early level of qualtrics and can't figure out how to implement your solution for disappearing default text/placeholder text ("attribute" and "input" haven't turned up any useful resources in the community) . Are you able to point to any more resources showing the step-by-step process? Thank you!
>
> !
>
Your image doesn't have a JS icon on the left, which means you haven't added the JavaScript. Click on the cog, select Add JavaScript, and paste the JS from the accepted answer above into the addOnload function.
Badge +2
@TomG , thank you for the code. I'm still at an early level of qualtrics and can't figure out how to implement your solution for disappearing default text/placeholder text ("attribute" and "input" haven't turned up any useful resources in the community) . Are you able to point to any more resources showing the step-by-step process? Thank you!

!
Userlevel 7
Badge +27
@red - You shouldn't need a loop...that's the beauty of jQuery. This should work:
```
<script>
Qualtrics.SurveyEngine.addOnload(function() {
jQuery("textarea").attr("placeholder","Enter your comments here.");
});
</script>
```
Userlevel 2
Badge +3
I had the same question. By adapting the info TomG sent, I was able to change all of my textarea default text with a jQuery loop in the theme footer like this. If each of your textareas need a different message, then (of course) this won't work.

<script>
Qualtrics.SurveyEngine.addOnload(function() {
jQuery("textarea").each(function() {
jQuery(this).attr("placeholder","Enter your comments here.");
});
});
</script>
Badge +1
Thanks Tom, i will try to find out the specific placeholder for each field.
Userlevel 7
Badge +27
> @khalid said:
>
> Can this also work in the Form text type? because when i used it it shows me First name in all the fields.

That line of JS adds the placeholder to all the elements in the question with a class of InputText. For a text form, you'd need to modify it to add specific placeholders to specific fields.
Badge +1
> @TomG said:
> Use JavaScript to add a placeholder attribute to the input element.
> ```
> jQuery("#"+this.questionId+" .InputText").attr("placeholder", "My placeholder text");
> ```
>

Can this also work in the Form text type? because when i used it it shows me First name in all the fields.
Badge
thanks again! @TomG
Userlevel 7
Badge +27
Use JavaScript to add a placeholder attribute to the input element.
```
jQuery("#"+this.questionId+" .InputText").attr("placeholder", "My placeholder text");
```

Leave a Reply