set single line Text box size by code | XM Community
Skip to main content

Hi,
I have set up a single line text box with the following javascript code for adding "Kg" text after the text entry. When I preview the question, the "Kg" is wrapped to the next line in mobile preview. How can I make them (text box and the "Kg" text in a single line in mobile?
Qualtrics.SurveyEngine.addOnload(function()
{
 /*Place Your Javascript Below This Line*/
 var inputs = $(this.getQuestionContainer()).select('inpututype="text"]');
for (var i = 0; i < inputs.length; i++) {
 var input = inputsui];
 $(input).insert({after: ' weight'});
}
});
I've tried the following suggestion on this. However, there's no change for both desktop and mobile preview.
https://www.qualtrics.com/community/discussion/252/how-do-i-specify-the-size-of-text-box-using-css
Can anybody show a sample for this work.
Thank you.

What type of question are you using?


Text entry.
Survey Basic Overview


Use the below code:
jQuery("#"+this.questionId+" input[type='text']").css("max-width","90%").after("Kg");


It works fine. Thank you very much.
Why can't I work it with HTML? I'm new to JQuery. Do you have to apply any specific settings of JQuery to Qualtrics?
Best.


Leave a Reply