JavaScript - Changing alignment of text entry boxes within a side-by-side question | XM Community
Question

JavaScript - Changing alignment of text entry boxes within a side-by-side question

  • 5 May 2020
  • 1 reply
  • 85 views

Hi,
I have a side-by-side question with a column of short text entry boxes. I've used the following code to add text after the boxes:-
for (var i = 0; i < inputs.length; i++) {
 var input = inputs[i];
$(input).insert({after: list[i]});
}
As a result my table now looks like this.
image.pngI've tried using this code to align the boxes to the left, so they'd all be straight.
jQuery("#"+this.questionId+" .ChoiceStructure").css("text-align","left");
I replaced this.questionId with the ID of the specific field, but no luck.
Does anyone have experience with this?


1 reply

Userlevel 7
Badge +22

Try the below code:
for (var i = 0; i < inputs.length; i++) {
 var input = inputs[i];
$(input).insert({after: list[i]});
$(input).parent().css("text-align","left");

}
OR
Check this

Leave a Reply