mercredi 27 septembre 2017

How to add time taken in a quiz using laravel 5.1 and/or javascript

I got stacked with this for 3 days, so I really need your help. Here we go, I want to implement a time getter or manager in my laravel5.1 application.

What I have:

$(document).ready(function(){
  var d;
  setInterval(function(){
    d = new Date();
    dates = d.getHours() + ':' + d.getMinutes() + ':' + d.getSeconds();
    $('#timeTaken').val(dates);
  }, 1000);

});
<script src="http://ift.tt/1oMJErh"></script>



<input type="text" id="timeTaken" value="">

What is the problem:

The scenario is, I already have this code above when I started the quiz. The problem is, if the user take the quiz, there are two buttons there where they can choose to just save what they done, or to submit the quiz. Now...


What I want:

1. Get the date/time when the quiz started. (I already have this one)

2. I need a timer that count the time taken by the user. Note: Quiz sometimes has time limit, sometimes unlimited time, but if the user want to save it for a while, the timer stop, and the user can continue the quiz later with the time left saved in the database.

3. Get the time taken by the user, for example 21 days 1 hour or 1 min 51 secs or 7 days 17 hours, etc.



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2fxyTym
via IFTTT

Aucun commentaire:

Enregistrer un commentaire