JAVA Script for HIDDEN | XM Community
Skip to main content

JAVA Script for HIDDEN

  • October 15, 2020
  • 4 replies
  • 95 views

I need help to get a JAVA script code into my survey for a "hidden" question. The question would only be seen by bots. It is the comparable to the @HIDDEN function in RedCap. Our survey will be posted on social media, so we are trying to limit fraud as much as possible.

4 replies

TomG
Level 8 ●●●●●●●●
Forum|alt.badge.img+27
  • Level 8 ●●●●●●●●
  • October 15, 2020

You can hide a question by adding this JavaScript to the question:
Qualtrics.SurveyEngine.addOnload(function() {
jQuery("#"+this.questionId).hide();
});


Thank you!


Follow up questions:

  1. Where you have "#" should I just put the question number or "Q#"?

  2. Do you know if this hides the question from data and analysis, too?


TomG
Level 8 ●●●●●●●●
Forum|alt.badge.img+27
  • Level 8 ●●●●●●●●
  • October 15, 2020

S_Jablonski96 ,

Where you have "#" should I just put the question number or "Q#"?

No, use it exactly as-is. "#" refers to the id attribute of the element, and this.questionId is the QID of the current question.
Do you know if this hides the question from data and analysis, too?

No, it doesn't hide it from data and analysis.