- Posts: 18
- Thank you received: 0
Ask the community, share ideas, and connect with other LimeSurvey users!
Please Log in to join the conversation.
Please Log in to join the conversation.
Please Log in to join the conversation.
Please Log in to join the conversation.
Please Log in to join the conversation.
Please Log in to join the conversation.
Please Log in to join the conversation.
I tried this code: manual.limesurvey.org/Workarounds:_Manip...cord_group_view_time but can't get it to work.
<script type="text/javascript" data-author="Tony Partner"> $(document).on('ready pjax:scriptcomplete',function(){ // Identify this question var thisQuestion = $('#question{QID}'); var timeInput = $('input:text.form-control:eq(0)', thisQuestion); var initSec = 0; // Check for elapsed time from previous visits if ($.trim($(timeInput).val()) != '') { var initTime = $.trim($(timeInput).val()); initTimeArr = initTime.split(':'); initSec = (Number(initTimeArr[0])*3600)+(Number(initTimeArr[1])*60)+(Number(initTimeArr[2])); } // Run the timer update function recordTime(initSec); // Timer update function function recordTime(elapsedSec){ var h = Math.floor(elapsedSec / 3600); var m = Math.floor(elapsedSec % 3600 / 60); var s = Math.floor(elapsedSec % 3600 % 60); var elapsedTime = (h > 0 ? h + ":" : "00:") + (m > 0 ? (m < 10 ? "0" : "") + m + ":" : "00:") + (s < 10 ? "0" : "") + s; $(timeInput).val(elapsedTime).trigger('keyup'); elapsedSec++; // Run the timer update function every second setTimeout(function() { recordTime(elapsedSec); }, 1000); } }); </script>
Please Log in to join the conversation.