How to disable/freeze a slider? | XM Community
Skip to main content
Solved

How to disable/freeze a slider?

  • March 2, 2021
  • 2 replies
  • 130 views

GrumpyCivet

Does anyone know how to disable/freeze a slider using javascript?

I am trying to make a survey with slider where people can go back and forth but would not be able to adjust their previous choices with sliders.

Best answer by GrumpyCivet

chu_2024 I actually figured out a solution:

  • you create an embedded data to flag if the participant has submitted a response to the slider

  • check on load using this embedded data to determine if we want to disable the slider

Qualtrics.SurveyEngine.addOnReady(function(){
var flag = parseInt("${e://Field/flag}");

if(flag==1){
jQuery("#"+this.questionId).css("pointer-events", "none");
};
});


Qualtrics.SurveyEngine.addOnPageSubmit(function(type)
{
if(type == "next")
{
Qualtrics.SurveyEngine.setEmbeddedData("flag", "1");
};
});


Note that this way of disabling is not perfect - you can still use "Tab" key to select the slider and move it with left and right arrow keys.

2 replies

Forum|alt.badge.img+1
  • March 24, 2021

I would like to do something similar but have not found a solution yet. Would really appreciate it if anyone could help!
@TomG would you be able to help with this? Thank you so much!


GrumpyCivet
  • Author
  • Answer
  • March 24, 2021

chu_2024 I actually figured out a solution:

  • you create an embedded data to flag if the participant has submitted a response to the slider

  • check on load using this embedded data to determine if we want to disable the slider

Qualtrics.SurveyEngine.addOnReady(function(){
var flag = parseInt("${e://Field/flag}");

if(flag==1){
jQuery("#"+this.questionId).css("pointer-events", "none");
};
});


Qualtrics.SurveyEngine.addOnPageSubmit(function(type)
{
if(type == "next")
{
Qualtrics.SurveyEngine.setEmbeddedData("flag", "1");
};
});


Note that this way of disabling is not perfect - you can still use "Tab" key to select the slider and move it with left and right arrow keys.