Trigger An Event When Clicking X Times - xclick

Trigger An Event When Clicking X Times - xclick
File Size: 9.2 KB
Views Total: 118
Last Update:
Publish Date:
Official Website: Go to website
License: MIT
   

xclick is an advanced click event handling jQuery plugin that enables you to perform a function when an element is clicked a certain number of times.

See Also:

How to use it:

1. Load the core JavaScript file index.js after jQuery (slim build is recommended).

<script src="/path/to/cdn/jquery.slim.min.js"></script>
<script src="/path/to/index.js"></script>

2. Attach the function xclick to the element and set the number of clicks that trigger the event. In this example, you will receive a notification when you click on this element three times in a row.

<button id="example">
  Click Me 3 Times
</button>
$(function(){
  $('button').xclick(3, () => {
    alert('Clicked 3 times in a row!');
  });
});

Changelog:

2021-06-09

  • v1.0.5

This awesome jQuery plugin is developed by Yash-Singh1. For more Advanced Usages, please check the demo page or visit the official website.