Hi,
a friend asked me to pimp his survey. One of the requirements was to add a global timer for a group of questions in order to stress the subject.
My first solution was to created an equation that stores a timestamp and then access it from javascript to compute the time difference. But equation functions use php, which runs on the server with a different time from the client.
Then I tried:
<script type="text/javascript" charset="utf-8">
jQuery(document).ready(function() {
document.write("{" + parseInt(new Date().getTime()/(1000)) + "}");
});
</script>But when looking at the question's source code, I realized that brackets are pre-processed.
Then I did:
<script type="text/javascript" charset="utf-8">
jQuery(document).ready(function() {
document.getElementById('answer847544X185X1603').value = parseInt(new Date().getTime()/(1000));
});
</script>This solution has one major problem, I cannot hide the question otherwise the answer isn't set.
At this point I disable the next button, hide the textarea, update the textarea and then skip to the next question.
Is there a better solution to this problem ?
Thank you in advance !