Static text, after a text entry box that is attached to a multiple choice selection, is slightly off | XM Community
Skip to main content
Solved

Static text, after a text entry box that is attached to a multiple choice selection, is slightly off


So I used the following code that I found on this site to add a " %" symbol after a text entry option. This worked for a question that only had a textbox in it, but not for another question that had two multiple choice (a YES and a NO), with the NO option requiring a numerical input. The percent symbol next to this box was slightly upwards and looks quite odd. This is the code I am using currently: Qualtrics.SurveyEngine.addOnload(function() { /*Place your JavaScript here to run when the page loads*/ var inputs = $(this.getQuestionContainer()).select('input[type="text"]') var input = inputs[0]; $(input).insert({after: ' %'}); }); And here is an image of what I am seeing: ! Any help in moving the percent symbol to be more centred would be appreciated.

Best answer by MatinE

For anyone dealing with this problem, I found a solution: Qualtrics.SurveyEngine.addOnload(function() { /*Place Your Javascript Below This Line*/ var inputs = $(this.getQuestionContainer()).select('input[type="text"]'); var input = inputs[0]; $(input).insert({after: '<span style="line-height:45px">%</span>'}); }); This I assume moves the line that the symbol rests on.
View original

2 replies

  • Author
  • 1 reply
  • Answer
  • August 16, 2019
For anyone dealing with this problem, I found a solution: Qualtrics.SurveyEngine.addOnload(function() { /*Place Your Javascript Below This Line*/ var inputs = $(this.getQuestionContainer()).select('input[type="text"]'); var input = inputs[0]; $(input).insert({after: '<span style="line-height:45px">%</span>'}); }); This I assume moves the line that the symbol rests on.

Forum|alt.badge.img+10
  • Level 2 ●●
  • 34 replies
  • November 17, 2020

MatinE I am having this same issue, but the code you provide above doesn't correct it for me. I don't see a difference between the code you first posted and the solution code above. Help? Thanks!


Leave a Reply