Aligning text boxes within a side-by-side question | XM Community
Solved

Aligning text boxes within a side-by-side question


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?

icon

Best answer by rondev 7 May 2020, 13:05

View original

3 replies

Userlevel 7
Badge +22

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

Worked like a charm, thanks so much!

Userlevel 3
Badge +6

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

Leave a Reply