- Posts: 3
- Thank you received: 0
Ask the community, share ideas, and connect with other LimeSurvey users!
script type=textjavascript charset=utf-8 $(document).ready(function() { Identify this question var qID = {QID}; var thisQuestion = $('#question'+qID); Define the sub-question code to be placed last var lastItem = 'SQ004'; Move that item to the end of the list $('.question-item[id$=X'+qID+lastItem+']', thisQuestion).addClass('last-item').parent().appendTo($('.subquestion-list', thisQuestion)); }); script
<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>
<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>
<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 = ['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).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>
// Multi-choice question with comments if($(thisQuestion).hasClass('multiple-opt-comments')) { $('.question-item[id$=X'+qID+val+']', thisQuestion).parent().appendTo($('.subquestion-list', thisQuestion)); }