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

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.

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


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


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++) { labelssi].parentElement.style.width = "60%"
}
});
 


Leave a Reply