- Posts: 18
- Thank you received: 4
Ask the community, share ideas, and connect with other LimeSurvey users!
<script type="text/javascript" charset="utf-8"> $(document).ready(function() { // Identify this question ID var qID = {QID}; // Build an array of subquestion codes var sqCodeArr = new Array(); $('#question'+qID+' table.question tbody tr').each(function(i) { var sqCode = $(this).attr('id').split('X'+qID+'')[1]; sqCodeArr.push(sqCode); }); // Find the highest code (alphabetically) sqCodeArr.sort(); var highCode = sqCodeArr[sqCodeArr.length-1]; // Now, move that subquestion to the bottom $('#question'+qID+' table.question tbody').append($('#question'+qID+' tr[id$="X'+qID+highCode+'"]')); }); </script>
<script type="text/javascript" charset="utf-8"> $(document).ready(function() { // Identify this question var qID = {QID}; // Place the "DK" code option at the end of the list var answer = $( 'input[id$="X'+qID+'DK"]'); var answerItem = $(answer).closest('li'); var answersList = $(answer).closest('ul'); $(answersList).append(answerItem); }); </script>