Custom code for creating space in between 2 specific options in a 3 item multiple choice format | XM Community
Skip to main content

Hi!
Can anyone please provide me with a custom code in order to create space in between 2 specific options (column style) in a 3-item multiple choice format. Please find attached an example of the desired end state.
Any help would be much appreciated, thank you!
example.png

Qualtrics.SurveyEngine.addOnReady(function () {
  const container = this.getQuestionContainer()
  let tbody = container.querySelector(
    "div.QuestionBody table.ChoiceStructure tbody"
  )
  let rows = tbody.childElements()
  let lastrow = rows rows.length - 1]
  let box = lastrow.querySelector("td.LabelContainer label")


  // add spacer
  const spacer = document.createElement("tr")
  tbody.insertBefore(spacer, lastrow)


  // OPTION: increase the value below to add more space
  spacer.style.height = "40px"


  // make second row button smaller
  box.style.display = "inline-block"


  // OPTION: adjust the value below to make second row button wider or more narrow
  box.style.paddingInline = "10px"
})



Leave a Reply