Cursor for text boxes in side by side question is centered. How can I make it left justified? Thank you | XM Community
Skip to main content
Solved

Cursor for text boxes in side by side question is centered. How can I make it left justified? Thank you

  • June 28, 2024
  • 4 replies
  • 116 views

Forum|alt.badge.img+1

When responding to a side by side question with a text box, the cursor is automatically centered. How can I make it left justified? Thank you in advance.

 

 

Best answer by RickB

Hey @researcher1 

you can try this code. You need to replacs QID3 with your own Question ID.


 

Qualtrics.SurveyEngine.addOnload(function() {

    // Replace 'QID3' with your actual Question ID

    var questionId = 'QID3';

    

    var inputs = document.querySelectorAll('#'+ questionId + ' input[type="text"], #' + questionId + ' input[type="number"], #' + questionId + ' textarea');

    inputs.forEach(function(input) {

        input.style.textAlign = 'left';

    });

});

 

4 replies

RickB
Level 4 ●●●●
Forum|alt.badge.img+22
  • Level 4 ●●●●
  • 128 replies
  • Answer
  • July 3, 2024

Hey @researcher1 

you can try this code. You need to replacs QID3 with your own Question ID.


 

Qualtrics.SurveyEngine.addOnload(function() {

    // Replace 'QID3' with your actual Question ID

    var questionId = 'QID3';

    

    var inputs = document.querySelectorAll('#'+ questionId + ' input[type="text"], #' + questionId + ' input[type="number"], #' + questionId + ' textarea');

    inputs.forEach(function(input) {

        input.style.textAlign = 'left';

    });

});

 


Forum|alt.badge.img+1
  • Author
  • 3 replies
  • July 4, 2024

Thank you so much @RickB! Your javascript works perfectly!!!


Forum|alt.badge.img+1
  • 3 replies
  • October 4, 2024

Hello

I am new to Java script and don’t know how to insert the code above or where. I have the exact same issue with my side by side text boxes


RickB
Level 4 ●●●●
Forum|alt.badge.img+22
  • Level 4 ●●●●
  • 128 replies
  • October 4, 2024

@culka594 

you have a option under the question on the left side. At the bottem is Javascript