- Posts: 6
- 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 the questions var thisQuestion = $('#question{QID}'); var hiddenQuestions = $(thisQuestion).nextAll('.text-long'); var textArea1 = $('textarea.form-control', thisQuestion); // Hide the hidden questions $(hiddenQuestions).hide(); // Set the timer interval (in milliseconds) var snapShotInterval = 60000; // Start the timer var snapShotTimer = setInterval(snapShot, snapShotInterval); function snapShot() { // Find all empty hidden textareas var nextTextArea = $('textarea.form-control', hiddenQuestions).filter(function(e) { return $(this).val() === ''; }); // Load the value of the first textarea into the first empty hidden textarea if(nextTextArea.length > 0) { $(nextTextArea).first().val($(textArea1).val()); } // Abort the timer when there are no more hidden textareas else { clearInterval(snapShotTimer); } } }); </script>