Welcome to the LimeSurvey Community Forum

Ask the community, share ideas, and connect with other LimeSurvey users!

Infotext within a free-text-field

  • Ursusprimus
  • Ursusprimus's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
4 years 8 months ago #186834 by Ursusprimus
Infotext within a free-text-field was created by Ursusprimus
Hi,
I'd like some infotext shown inside a free-text-field, which should disappear when entering text. See attachment. Any ideas how to do it?
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
4 years 8 months ago - 4 years 8 months ago #186839 by tpartner
Replied by tpartner on topic Infotext within a free-text-field
That is known as a placeholder.

Try something like this in the question source:

Code:
<script type="text/javascript" charset="utf-8">
 
$(document).on('ready pjax:scriptcomplete',function(){
 
        $('#question{QID} input:text').attr('placeholder', 'My placeholder text...');
    });
</script>

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Last edit: 4 years 8 months ago by tpartner.
The following user(s) said Thank You: Ursusprimus
The topic has been locked.
  • Joffm
  • Joffm's Avatar
  • Away
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
4 years 8 months ago #186840 by Joffm
Replied by Joffm on topic Infotext within a free-text-field
Hi,
I think you have to remove the linefeed from

$(document).on('ready
pjax:scriptcomplete',function(){...

to
$(document).on('ready pjax:scriptcomplete',function(){...

Joffm

Volunteers are not paid.
Not because they are worthless, but because they are priceless
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
4 years 8 months ago #186841 by tpartner
Replied by tpartner on topic Infotext within a free-text-field
Thanks, that's what I get for responding via phone. :)

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The following user(s) said Thank You: Ursusprimus
The topic has been locked.
  • Ursusprimus
  • Ursusprimus's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
4 years 8 months ago #186844 by Ursusprimus
Replied by Ursusprimus on topic Infotext within a free-text-field
it's working fine, thank you!
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose