I need to recognize a long click in a JavaScript bookmarklet.
So, I cannot use jQuery, neither onclick() event and similar. Is it possible, and how?
I need to recognize a long click in a JavaScript bookmarklet. So, I cannot
Share
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.
onmousedown, callsetTimeout()for the duration of your long click. If the timeout is allowed to expire, it will call its function to do whatever you hoped to do on the long click. However,onmouseupyou cancel thesetTimeout()if it has not yet expired.Here it is in action in jsfiddle