JAVA Script for HIDDEN | XM Community

JAVA Script for HIDDEN

  • 15 October 2020
  • 4 replies
  • 43 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

Userlevel 7
Badge +27

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?

Userlevel 7
Badge +27

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.

Leave a Reply