Quantcast
Viewing all articles
Browse latest Browse all 17529

Randomize answers except a few at bottom - by: tpartner

Assuming you are using the latest LimeSurvey version, this will fix a number of sub-questions to the bottom for both multi-choice and array type questions.

<script type="text/javascript" charset="utf-8">
	$(document).ready(function() {
 
		// Identify this question
		var qID = {QID};
		var thisQuestion = $('#question'+qID);
 
		// Define the sub-question codes to be placed last
		var lastItems = ['SQ006', 'SQ007', 'SQ008'];
 
		// Loop through those sub-question codes 
		$.each(lastItems, function(i, val) {
			// Move that item to the end of the list
			// Multi-choice question
			if($(thisQuestion).hasClass('multiple-opt')) {
				$('.question-item[id$=X'+qID+val+']', thisQuestion).parent().appendTo($('.subquestion-list', thisQuestion));
			}
			// Array question
			if($(thisQuestion).hasClass('array-flexible-row')) {
				$('.answers-list[id$=X'+qID+val+']', thisQuestion).appendTo($('table.subquestion-list', thisQuestion));
			}
		});
	});
</script>

Sample survey attached

File Attachment:

File Name: limesurvey_survey_885886_2017-08-14.lss
File Size: 25 KB

Viewing all articles
Browse latest Browse all 17529

Trending Articles



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