Aligning text boxes within a side-by-side question | XM Community
Skip to main content
Solved

Aligning text boxes within a side-by-side question

  • May 7, 2020
  • 3 replies
  • 275 views

Hi,

I've got a side-by-side question and due to the text I've added after the fields, it looks like this.
image.pngI've tried multiple JS/CSS ways of aligning these fields to the left, or centering them properly, but I'm having no luck.
Does anyone know how i might go about solving this?

Best answer by rondev

Try the below code if the text entry column is your second column in SBS question, else find the class name of its "td" tag and add below css
jQuery("#"+this.questionId+" td.c7").css("text-align","left");

3 replies

rondev
Level 6 ●●●●●●
Forum|alt.badge.img+22
  • Level 6 ●●●●●●
  • Answer
  • May 7, 2020

Try the below code if the text entry column is your second column in SBS question, else find the class name of its "td" tag and add below css
jQuery("#"+this.questionId+" td.c7").css("text-align","left");


  • Author
  • May 7, 2020

Worked like a charm, thanks so much!


Forum|alt.badge.img+10
  • Level 2 ●●
  • February 11, 2022

rondev or anyone - Could you share how to modify my code to get the static text to the right of the text boxes to be different on different rows of an SbS matrix like in the example above?
I am using this code on the entire column but I need to change the units on a few rows. Thanks!
var inputs = $(this.getQuestionContainer()).select('input[type="number"]');
for (var i = 0; i < inputs.length; i++) {
 var input = inputs[i];
 $(input).insert({after: ' pounds'});