- Posts: 4
- Thank you received: 0
Ask the community, share ideas, and connect with other LimeSurvey users!
The random name is <span class="random-name">&nbsp;</span>. <script type="text/javascript" charset="utf-8"> $(document).on('ready pjax:scriptcomplete',function(){ // Define the names var names = ['Tom', 'Dick', 'Harry', 'Jane', 'Susan', 'Mary']; // Randomize the names shuffleArray(names); // Load the <span> element with the random name $('#question{QID} span.random-name').text(names[0]); }); 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; } </script>