how to get an event's completion time in jquery
javascript, jquery, performance
Solution
Pass event as argument.
var createdTime;
jQuery('.btn-check-box').click(function(e){
createdTime = e.timeStamp;
}).done(function(){ calculate time difference });
if you will use `console.log(e)` then it will show you that jQuery already passing timestamp when event is triggered.
so now you need to find a way when even is getting done so `.done()` jQuery method will help you.
In side .done() you can also get same `e.timestamp` and do some math on to get your desired out put in second, minutes or anything.
Problem
hi i am using jquery . i have a check box click event ``` jQuery('.btn-check-box').click(function () { //code goes here . }); ``` the problem is the click event takes considerable time to complete.some times the browser gets stuck. so i want to change the code inside the function and reduce the completion time . now i want to get my current click event completion time . then make changes to the code and again check the completion time . so i can optimize my code according to the completion time . is there any way to check an events completion time . please help. thanks in advance.