Fixing JS on slider questions to reformat respondents' response summary | XM Community
Question

Fixing JS on slider questions to reformat respondents' response summary

  • 11 March 2019
  • 3 replies
  • 4 views

Userlevel 2
I added the following JS to my slider questions, which moved the slider labels to be placed below the slider. However, it totally messed up my response summary (the summary that respondents get of their own responses before submitting the survey).

{jQuery("ul.labels").insertAfter("div.slider-container:last");}

Basically the problem is that now that in the respondent's response summary, the slider questions are all clumped together, and the labels are all clumped together at the bottom (aka the labels are detached from the sliders!).

Does anyone have any guidance here?

3 replies

Hi @qualtricsnoob ,

Try using the below code:

`jQuery("#"+this.questionId+" ul.labels").insertAfter("#"+this.questionId+" div.slider-container:last");`
Userlevel 2
Hi @Shashi ,

Thanks for the response. That didn't seem to work. In the respondents' response summary, the labels are still detached from the sliders.

Could it be where I am placing the code? I have edited the question JS as follows:

Qualtrics.SurveyEngine.addOnload(function()
{
/*Place your JavaScript here to run when the page loads*/

});

Qualtrics.SurveyEngine.addOnReady(function()
{
/*Place your JavaScript here to run when the page is fully displayed*/
jQuery("#"+this.questionId+" ul.labels").insertAfter("div.slider-container:last");

});

Qualtrics.SurveyEngine.addOnUnload(function()
{
/*Place your JavaScript here to run when the page is unloaded*/

});

Thanks!
> @qualtricsnoob said:
> Hi @Shashi ,
>
> Thanks for the response. That didn't seem to work. In the respondents' response summary, the labels are still detached from the sliders.
>
> Thanks!

Please try using the updated code

jQuery("#"+this.questionId+" ul.labels").insertAfter("#"+this.questionId+" div.slider-container:last");

Leave a Reply