Javascript to move the margin of a question | XM Community
Solved

Javascript to move the margin of a question

  • 27 November 2018
  • 4 replies
  • 189 views

I have a multiple choice question after another question that I want to indent slightly.
Trying to achieve something that looks like this:

Question 1

(Indent) Question 2 (2-columned)
(Indent) - choice 1
(Indent) - choice 2...

I was thinking JS for the question rather than CSS since, CSS would change all the margins for that question type.
icon

Best answer by tchen 28 November 2018, 00:01

View original

4 replies

In case anyone is looking. 45 is what you want to change to get the indent you want. Works for column MC questions too.

Qualtrics.SurveyEngine.addOnload(function()
{
jQuery("#"+this.questionId).find('.QuestionBody:first').css("margin-left", "45px");

});
Userlevel 3
Badge +6
@tchen: Is it possible to modify this code to indent individual response options of a MC question (rather than the whole set)?
I have a MC question with a group and I would like just that group of responses to be further indented from the other choices. See image. Possible to move the types of pizza further right?
!
> @Nadaly said:
> @tchen: Is it possible to modify this code to indent individual response options of a MC question (rather than the whole set)?
> I have a MC question with a group and I would like just that group of responses to be further indented from the other choices. See image. Possible to move the types of pizza further right?
>
>
@Nadaly

Paste the below code in the Multi choice question js(onReady)

jQuery(".Skin .ChoiceGroupStructure").css("margin-left","30px");
Badge +1

@tchen Thank you for your response on this! I am trying to do something similar (indent a sliding scale question 45 px). I tried using your javascript code, but I am seeing no change. Any tips? Thanks!

Leave a Reply