Quantcast
Viewing all articles
Browse latest Browse all 17529

Slider questions with two times the same values - by: tpartner

Is this possible to use the same values two times?

If you are using LimeSurvey version 2.5.x and you want to show absolute values in the slider tooltip (callout)...

1) Set up your survey to use JavaScript

2) Give the slider question a positive number (9) for the maximum and a negative number (-9) for minimum

3) Hide the tip in the slider question via advanced settings

4) Add this script to the question source

<script type="text/javascript" charset="utf-8">
 
	$(document).ready(function() {
 
		// Identify this question
		var thisQuestion = $('#question{QID}');
 
		// Insert a fake tooltip (callout)		
		setTimeout(function() {
			$('.answer-item', thisQuestion).each(function(i) {
				var thisValue = $('input[type="text"]', this).val();
				$('.tooltip-inner', this).hide().after('<div class="tooltip-inner fake" />');
				$('.tooltip-inner.fake', this).text(Math.abs(thisValue));
			});
		}, 100);
 
		// Listener on sliders		
		$('input[type="text"]', thisQuestion).on('slide slideStop', function(event, ui) {
			var thisValue = $(this).val();
			$(this).closest('.answer-item').find('.tooltip-inner.fake').text(Math.abs(thisValue));
		});
	});
</script>


Viewing all articles
Browse latest Browse all 17529

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>