- Posts: 4
- Thank you received: 1
Ask the community, share ideas, and connect with other LimeSurvey users!
Please Log in to join the conversation.
pardon, but what is too complex to implement one of these two "standared" solutions.they were to complex to implement.
function shuffle(array) { var currentIndex = array.length, temporaryValue, randomIndex; while (0 !== currentIndex) { randomIndex = Math.floor(Math.random() * currentIndex); currentIndex -= 1; temporaryValue = array[currentIndex]; array[currentIndex] = array[randomIndex]; array[randomIndex] = temporaryValue; } return array; } $(document).on('ready pjax:scriptcomplete',function(){ // Fill the array let countAllQuestions = 10; let countShown = 4; var arr = []; for (var i = 1; i <= countAllQuestions; i++) { arr.push(('00'+i).slice(-3)); } arr = shuffle(arr).slice(0,countShown).join(','); $('#question{QID} input[type="text"]').val('#'+arr); $('#question{QID}').hide(); }); </script>
Please Log in to join the conversation.
Please Log in to join the conversation.