How to determine the execution time of a jQuery selection

Hi Experts!

I have the following jquery selection query:

$("*", $('id')).closest('tr').serializeArray();

I would like to know how much time this takes to be executed. How one can determine this?

Thank you!
Who is Participating?
sjklein42Connect With a Mentor Commented:
Try this:

var currentTime = new Date();
var startTime = currentTime.getTime();

// do your thing here
$("*", $('id')).closest('tr').serializeArray();

var deltaTime = currentTime.getTime() - startTime;
alert('operation took ' + deltaTime + ' msec');

Open in new window

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.