- Posts: 7
- Thank you received: 0
Ask the community, share ideas, and connect with other LimeSurvey users!
<script type="text/javascript" charset="utf-8"> $(document).ready(function(){ // Identify this question var qID = {QID}; var thisQuestion = $('#question'+qID); // Generate random number between 1 & 2 var rand = Math.floor(Math.random() * 2) + 1 // If the random number = 2... if(rand == 2) { // Reverse the answer order (excepting the last answer) var lastAnswer = $('.answer-item:last', thisQuestion); var tr = $('.answer-item', thisQuestion).not(lastAnswer).detach().toArray(); tr.reverse(); $.each(tr, function(i, el) { $('.answers-list', thisQuestion).append(el); }); $('.answers-list', thisQuestion).append(lastAnswer); } }); </script>