- Posts: 14
- Thank you received: 0
Ask the community, share ideas, and connect with other LimeSurvey users!
<script type="text/javascript" charset="utf-8"> $(document).on('ready pjax:scriptcomplete',function(){ // Identify this question ID var qID = '{QID}'; // List the sub-question codes to be placed at the end of the list // (comma-separated) var lastItems = ['SQ007','SQ008']; // Insert the last items $.each(lastItems, function(i, val) { $('#question{QID} tr[id^="javatbd"]:last').after($('#question{QID} tr[id^="javatbd"][id$="X'+qID+val+'"]')); }); }); </script>
// The number of answers to be fixed at the end of the list var fixedAnswers = 2; // Set this to "true" if you want "Other" to be fixed in the last position var otherFixed = false;
// The number of answers to be fixed at the end of the list var fixedAnswers = 2; // Set this to "true" if you want "Other" to be fixed in the last position var otherFixed = false;
<script type="text/javascript" charset="utf-8"> $(document).on('ready pjax:scriptcomplete',function(){ // Identify this question var qID = {QID}; var thisQuestion = $('#question'+qID); // Define the sub-question codes to be placed last var lastItems = ['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).appendTo($('.question-item[id$=X'+qID+val+']', thisQuestion).parent()); } // Array question if($(thisQuestion).hasClass('array-flexible-row')) { $('.answers-list[id$=X'+qID+val+']', thisQuestion).appendTo($('table.subquestion-list tbody:last', thisQuestion)); } // List-radio question if($(thisQuestion).hasClass('list-radio')) { $('.answer-item[id$=X'+qID+val+']', thisQuestion).appendTo($('.answer-item[id$=X'+qID+val+']', thisQuestion).parent()); } }); }); </script>
$.each(lastItems, function(i, val) { $('#question{QID} tr[id^="javatbd"]:last').after($('#question{QID} tr[id^="javatbd"][id$="X'+qID+val+'"]')); });
$.each(lastItems, function(i, val) { $('.question-item[id$=X'+qID+val+']', thisQuestion).appendTo($('.question-item[id$=X'+qID+val+']', thisQuestion).parent());
// Define the sub-question codes to be placed last var lastItems = ['SQ008', 'SQ009'];
// The number of answers to be fixed at the end of the list var fixedAnswers = 2; // Set this to "true" if you want "Other" to be fixed in the last position var otherFixed = false;