Change placeholder text color | XM Community
Skip to main content

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);
});

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);
});
    
});


 

 


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