- Posts: 2
- 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); // Build an array of 10 random numbers between 1 and 2000 var numbers = []; while(numbers.length < 10){ var randomnumber = Math.ceil(Math.random()*2000) if(numbers.indexOf(randomnumber) > -1) continue; numbers[numbers.length] = randomnumber; } // Load the question $(numbers).each(function(i, value) { $('input[type="text"]:eq('+i+')', thisQuestion).val(value); }); }); </script>