Quantcast
Channel: Topics in Category: Can I do this with LimeSurvey? - LimeSurvey forums
Viewing all articles
Browse latest Browse all 17529

Randomize answers except a few at bottom - by: tpartner

$
0
0
This should work for list-radio questions as well:

<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));
			}
			// List-radio question
			if($(thisQuestion).hasClass('list-radio')) {
				$('.answer-item[id$=X'+qID+val+']', thisQuestion).appendTo($('.answers-list', thisQuestion));
			}
		});
	});
</script>

Viewing all articles
Browse latest Browse all 17529

Trending Articles