- Posts: 2
- Thank you received: 1
Ask the community, share ideas, and connect with other LimeSurvey users!
<script type="text/javascript" charset="utf-8"> function shuffleArray(array) { for (var i = array.length - 1; i > 0; i--) { var j = Math.floor(Math.random() * (i + 1)); var temp = array[i]; array[i] = array[j]; array[j] = temp; } return array; } $(document).on('ready pjax:complete',function() { var thisQuestion = $('#question{QID}'); var elements = $('tr.answers-list', thisQuestion).detach().toArray(); shuffleArray(elements); $('tr.answers-list', thisQuestion).remove(); $. each (elements, function(i, el) { $('table.subquestion-list tbody:eq(0)', thisQuestion).append(el); }); }); </script>
Please Log in to join the conversation.
Please Log in to join the conversation.
Please Log in to join the conversation.
Please Log in to join the conversation.
Please Log in to join the conversation.
It looks like the code got messed up by the forum editor.Workaround...
<script type="text/javascript" charset="utf-8"> function shuffleArray(array) { for (var i = array.length - 1; i > 0; i--) { var j = Math.floor(Math.random() * (i + 1)); var temp = array[i]; array[i] = array[j]; array[j] = temp; } return array; } $(document).on('ready pjax:complete',function() { var thisQuestion = $('#question{QID}'); var elements = $('tr.answers-list', thisQuestion).detach().toArray(); shuffleArray(elements); $('tr.answers-list', thisQuestion).remove(); $. each (elements, function(i, el) { $('table.subquestion-list tbody:eq(0)', thisQuestion).append(el); }); }); </script>
Please Log in to join the conversation.