Randomize some items in list, multiple-choice and array questions
Use the following script to fix some items to stay at the bottom of a randomized list of sub-questions:

Add the following code to your questions' Advanced settings->JavaScript field:

Where you see var lastItems and SQ006, SQ007, SQ008 -- you'd replace this with the sub-question codes in your own question (the ones you want to keep at the end of the question)

	$(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));
			}
		});	
	});

We greatly appreciate your feedback.




Powered by LiveZilla Helpdesk