JS to insert space and text in Form Field | XM Community
Skip to main content
Solved

JS to insert space and text in Form Field

  • June 29, 2023
  • 3 replies
  • 154 views

PaulMc5209
Level 1 ●
Forum|alt.badge.img+3

Hello,

 

I am trying to edit a form field that has 3 fields.  The first two are lbs and oz, while the third is grams

I know how to get the lbs and oz after the first two fields, but I would like to have some space then “OR” some space, and then the grams field.

 

Thanks in advance.

 

Paul

Best answer by TomG

Try this:

Qualtrics.SurveyEngine.addOnload(function() {
jQuery(this.questionContainer).find("tr:last td").css("padding-top","20px");
});

 

3 replies

TomG
Level 8 ●●●●●●●●
Forum|alt.badge.img+27
  • Level 8 ●●●●●●●●
  • Answer
  • June 29, 2023

Try this:

Qualtrics.SurveyEngine.addOnload(function() {
jQuery(this.questionContainer).find("tr:last td").css("padding-top","20px");
});

 


PaulMc5209
Level 1 ●
Forum|alt.badge.img+3
  • Author
  • Level 1 ●
  • June 29, 2023

Try this:

Qualtrics.SurveyEngine.addOnload(function() {
jQuery(this.questionContainer).find("tr:last td").css("padding-top","20px");
});

 

@TomG This works great. How would I insert OR between the 2nd and 3rd fields?

 


TomG
Level 8 ●●●●●●●●
Forum|alt.badge.img+27
  • Level 8 ●●●●●●●●
  • June 29, 2023

@TomG This works great. How would I insert OR between the 2nd and 3rd fields?

 

Qualtrics.SurveyEngine.addOnload(function() {
jQuery(this.questionContainer).find("tr:last").before("<tr colspan='2'><td>OR</td></tr>");
});