Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

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.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6707203
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T07:36:42+00:00 2026-05-26T07:36:42+00:00

Is there something in jquery that would allow me to differentiate between behavior on

  • 0

Is there something in jquery that would allow me to differentiate between behavior on double click and single click?

When I bind both to same element only the single click gets executed.

Is there a way that wait for some time before execution of the single click to see if the user clicks again or not?

Thanks 🙂

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T07:36:42+00:00Added an answer on May 26, 2026 at 7:36 am

    I found that John Strickler’s answer did not quite do what I was expecting. Once the alert is triggered by a second click within the two-second window, every subsequent click triggers another alert until you wait two seconds before clicking again. So with John’s code, a triple click acts as two double clicks where I would expect it to act like a double click followed by a single click.

    I have reworked his solution to function in this way and to flow in a way my mind can better comprehend. I dropped the delay down from 2000 to 700 to better simulate what I would feel to be a normal sensitivity. Here’s the fiddle: http://jsfiddle.net/KpCwN/4/.

    Thanks for the foundation, John. I hope this alternate version is useful to others.

    var DELAY = 700, clicks = 0, timer = null;
    
    $(function(){
    
        $("a").on("click", function(e){
    
            clicks++;  //count clicks
    
            if(clicks === 1) {
    
                timer = setTimeout(function() {
    
                    alert("Single Click");  //perform single-click action    
                    clicks = 0;             //after action performed, reset counter
    
                }, DELAY);
    
            } else {
    
                clearTimeout(timer);    //prevent single-click action
                alert("Double Click");  //perform double-click action
                clicks = 0;             //after action performed, reset counter
            }
    
        })
        .on("dblclick", function(e){
            e.preventDefault();  //cancel system double-click event
        });
    
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is there a built in function in jQuery that would allow me to get
Do we have a document for jQUery 1.4.2..something that says this was there in
Is there something like serialize/unserialize PHP functions in jQuery? These functions return a string
Is there any way to do something conditionally in jquery only if IE6 is
Is there something like InstallShield that I can use for free?
Is there something like Python's getattr() in C#? I would like to create a
Is there something like a panel that I can use in a MFC application.
Is there something similar to sprintf() in C#? I would for instance like to
I've noticed that a lot of Javascript/jQuery libraries allow developers to customize the .js
Is there a selector or function in JQuery that allows to select the current

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.