GeeksforGeeks

How to detect idle time in JavaScript elegantly?

The timer will be incremented every second to denote the idle time. Interaction with the mouse or keyboard will reset and hide the timer.

You are idle for seconds.