Languages
[Edit]
EN

jQuery - mouse double click (dblclick) event

10 points
Created by:
May87
827

In this article, we would like to show you how to create the double click event using jQuery.

1. dblclick method example

// ONLINE-RUNNER:browser;

<!doctype html>
<html>
<head>
  <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.0.0/jquery.min.js"></script>
</head>
<body>
  <button id="button">Click me double times!</button>
  <script>

    $(document).ready(function() {
		var button = $('#button');
      
      	button.dblclick(function() {
        	button.text('Button double clicked!');
        });
    });

  </script>
</body>
</html>

2. on method with event name example

// ONLINE-RUNNER:browser;

<!doctype html>
<html>
<head>
  <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.0.0/jquery.min.js"></script>
</head>
<body>
  <button id="button">Click me double times!</button>
  <script>

    $(document).ready(function() {
		var button = $('#button');
      
      	button.on('dblclick', function() {
        	button.text('Button double clicked!');
        });
    });

  </script>
</body>
</html>

3. on method with event object example

// ONLINE-RUNNER:browser;

<!doctype html>
<html>
<head>
  <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.0.0/jquery.min.js"></script>
</head>
<body>
  <button id="button">Click me double times!</button>
  <script>

    $(document).ready(function() {
		var button = $('#button');
      
      	button.on({
            'dblclick': function() {
        	    button.text('Button double clicked!');
            }
        });
    });

  </script>
</body>
</html>
Donate to Dirask
Our content is created by volunteers - like Wikipedia. If you think, the things we do are good, donate us. Thanks!
Join to our subscribers to be up to date with content, news and offers.

jQuery

Native Advertising
🚀
Get your tech brand or product in front of software developers.
For more information Contact us
Dirask - we help you to
solve coding problems.
Ask question.

❤️💻 🙂

Join