Hidden Question Still Showing - JS Advice? | XM Community
Question

Hidden Question Still Showing - JS Advice?

  • 24 February 2021
  • 1 reply
  • 171 views

I am trying to hide a question for all participants. This code is working, but it flashes the question for a fraction of a second (not ideal). Can anyone suggest code to make sure the question is fully hidden? I cannot use display logic because the question needs to actually occur - just out of the participants' view.

Qualtrics.SurveyEngine.addOnReady(function () {
  var $this = jQuery(this.questionContainer);
  $this.hide(); //this line will hide the question for participants
});


1 reply

Userlevel 7
Badge +21

If you're doing nothing else apart from hiding the question, use the TRUE-FALSE display logic, setting it to false.
Alternatively, you could try this code:
Qualtrics.SurveyEngine.addOnload(function () {
    this.getChoiceContainer().hide();
});
If you're still not satisfied with the results, then add this to the top of your question HTML:


This will push everything down by an amount equal to the hieght of the window. So, effectively nothing is visible.
You can use CSS to avoid the flashing/scrolling down, however, these styles will also be effective in the survey editor. So, unless you know how to work with CSS, I would recommend using one of the 4 methods at your disposal.


Leave a Reply