I am creating a question on how much people spend on a product.
This is how I’d like the question to behave:
The “£” sign and “per year” should be fixed either side of the text box, but a standard text box question type doesn’t seem to allow that. Is there a way around this?
Thank you for your help!
Zoe
Best answer by Deepak
@ZoeRobo
Try and add the below JS on the text entry question.
Qualtrics.SurveyEngine.addOnload(function() { /*Place Your Javascript Below This Line*/ jQuery("#" + this.questionId + " .InputText").css('width','80%') //adjust accordingly var inputs = $(this.getQuestionContainer()).select('input[type="text"]'); for (var i = 0; i < inputs.length; i++) { var input = inputs[i]; $(input).insert({before: '£ '}); $(input).insert({after: ' per year'}); }
Hi @ZoeRobo Create a text graphic question and insert this code in the HTML view of the question text.
<div class="spending-question"> <span class="currency-symbol">Approximately how much do spend per year on the products?</span></div><div class="spending-question"><span class="currency-symbol"><br>£</span> <input class="amount-input" type="text"> <span class="per-year">per year</span> </div>
Hello @Deepak , I see I was too hasty, my apologies. I can see that your solution enables capturing the answer to the survey. Thank you for pointing that out. I am not sure how to change “best answer” - hopefully I haven’t caused a problem..