Change placeholder text color | XM Community
Skip to main content
Solved

Change placeholder text color


Forum|alt.badge.img+3

We used custom code to set up placeholder text in open end text boxes to prompt the user to provide detailed feedback etc. Is there a way to change the placeholder text’s font color? We are not sure what attribute/class it is to alter that, if it’s available at all. 

 

var placeholderText = 'Use this section for additional feedback.';
jQuery('#' + qid + ' input[type="text"], #' + qid + ' textarea').attr('placeholder',placeholderText);
});

Best answer by nikamshubham_73

Hi ​@sonpage,

You can use the code below to change the color of the placeholder text. The placeholder will appear in blue, but once a value is entered, it will revert to the default Qualtrics color. Hope this helps!
 

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

    jQuery("textarea").attr("placeholder", "Color text");

    jQuery("textarea").each(function() {
    var style = document.createElement('style');
    style.innerHTML = 'textarea::placeholder { color: blue !important; }';
    document.head.appendChild(style);
});
    
});


 

 

View original

2 replies

Forum|alt.badge.img+3
  • Level 2 ●●
  • 20 replies
  • Answer
  • February 12, 2025

Hi ​@sonpage,

You can use the code below to change the color of the placeholder text. The placeholder will appear in blue, but once a value is entered, it will revert to the default Qualtrics color. Hope this helps!
 

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

    jQuery("textarea").attr("placeholder", "Color text");

    jQuery("textarea").each(function() {
    var style = document.createElement('style');
    style.innerHTML = 'textarea::placeholder { color: blue !important; }';
    document.head.appendChild(style);
});
    
});


 

 


Forum|alt.badge.img+3
  • Author
  • QPN Level 2 ●●
  • 7 replies
  • February 20, 2025
nikamshubham_73 wrote:

Hi ​@sonpage,

You can use the code below to change the color of the placeholder text. The placeholder will appear in blue, but once a value is entered, it will revert to the default Qualtrics color. Hope this helps!
 

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

    jQuery("textarea").attr("placeholder", "Color text");

    jQuery("textarea").each(function() {
    var style = document.createElement('style');
    style.innerHTML = 'textarea::placeholder { color: blue !important; }';
    document.head.appendChild(style);
});
    
});


 

 

Thank you! Will try this. 


Leave a Reply