- Posts: 8
- 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() { var qID = {QID}; var submitID = {SUBMITID}; // Array of answer codes var codeArray = ['SQ001', 'SQ002', 'SQ003', 'SQ004']; // Find the modulus of the submit ID by the array length var submitModulus = submitID % codeArray.length; // Rotate through the array depending on the modulus for (var i=0; i<submitModulus; i++) { codeArray.push(codeArray.shift()) } // Hide the hidden question $('#question'+qID+' input.text').hide(); // Load the hidden question $('#question'+qID+' input.text').val(codeArray); }); </script>