How can I adjust the width of the question options in a form field question - JavaScript? | XM Community
Skip to main content
Question

How can I adjust the width of the question options in a form field question - JavaScript?

  • January 18, 2022
  • 3 replies
  • 1187 views

Screen Shot 2022-01-17 at 6.08.17 PM.pngHi Everyone!
Here is a screenshot of what I'm working with. I would like to adjust the width of the question options. I have tried the HTML but some of the options are very long so I need the text to wrap at a certain width, ideally. Thank you for your assistance.

3 replies

Rudi
QPN Level 3 ●●●
Forum|alt.badge.img+16
  • QPN Level 3 ●●●
  • 162 replies
  • January 18, 2022

Hi,
this should do the magic :
Qualtrics.SurveyEngine.addOnload(function()
{
let labels =document.getElementsByClassName("LabelWrapper")
for(let i=0;i labels[i].parentElement.style.width = "60%"
}
});
Adopt the width according to your liking/needs.

Best regards

Rudi


Forum|alt.badge.img
  • 2 replies
  • September 14, 2023

Hi Rudi,

 

I’m trying to make the same adjustment as elowey, but when I try using the code you suggest, I get the error “unexpected identifier”.

I don’t know Java at all, so I’m really just copying and pasting. Any suggestions?

 

Best,

Zak


Forum|alt.badge.img
  • 1 reply
  • September 21, 2023

The code provided was not complete. It should be like:

 

Qualtrics.SurveyEngine.addOnload(function()
{
let labels =document.getElementsByClassName("LabelWrapper")
for(let i=0;i < labels.length;i++) { labels[i].parentElement.style.width = "60%"
}
});