I need to know if there are no keydowns or clicks for 10 seconds and if so display an alert window, I can use jquery if it’s more efficient than simple js.
How can I do it? Thanks
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Something like this:
JSFiddle
It assumes you haven’t bound anything else to the documents keydown listener. If you have then you should use
addEventListenerandattachEventinstead.