Change default value for smile slider | XM Community
Skip to main content
Solved

Change default value for smile slider


Forum|alt.badge.img+3

I am using smile slider in one of my question.

The default value is neutral. I would like to change it.

Is there any code I can use 

 

 

 I browsed through few questions here and found that this was raised as product idea about 3 years ago 

 

Best answer by Shashi

We can use the below code in addOnReady function for graphic slider smile question type to set custom default value of slider. Here default value simply means what the respondent will see first time; they have to still click on slider to record response.

	var defvalue = 5;
	var that = this;
	setTimeout(function(){ 
		jQuery("#"+that.questionId+" .Smile").css("display","none");
		jQuery("#"+that.questionId+" .Smile.SS"+defvalue).css("display","block");
		jQuery("#"+that.questionId+" .handle").css("left",((defvalue-1)*45)+"px");
	}, 10);

 

View original

3 replies

Shashi
Level 8 ●●●●●●●●
Forum|alt.badge.img+32
  • Level 8 ●●●●●●●●
  • 633 replies
  • Answer
  • April 29, 2023

We can use the below code in addOnReady function for graphic slider smile question type to set custom default value of slider. Here default value simply means what the respondent will see first time; they have to still click on slider to record response.

	var defvalue = 5;
	var that = this;
	setTimeout(function(){ 
		jQuery("#"+that.questionId+" .Smile").css("display","none");
		jQuery("#"+that.questionId+" .Smile.SS"+defvalue).css("display","block");
		jQuery("#"+that.questionId+" .handle").css("left",((defvalue-1)*45)+"px");
	}, 10);

 


Forum|alt.badge.img+3
  • Author
  • Level 1 ●
  • 6 replies
  • April 29, 2023

Many Thanks @Shashi for quick response.

Is there any repository where I can search for useful codes.



 


Shashi
Level 8 ●●●●●●●●
Forum|alt.badge.img+32
  • Level 8 ●●●●●●●●
  • 633 replies
  • April 29, 2023
vinodvyas wrote:

Many Thanks @Shashi for quick response.

Is there any repository where I can search for useful codes.



 

Not aware of any such one repository but you can refer this community section to get various code snippets.


Leave a Reply