jQuery Plugin To Bind Single Click Event To Element - singleclick.js

jQuery Plugin To Bind Single Click Event To Element - singleclick.js
File Size: 2.72 KB
Views Total:
Last Update:
Publish Date:
Official Website: Go to website
License: MIT
   

Just another lightweight jQuery plugin that binds a 'single click' event to prevent user from double clicking on a specific element. Very useful to distinguish between single and double click events.

How to use it:

1. Link jQuery library and the jQuery singleclick.js script to your html page.

<script src="//code.jquery.com/jquery.min.js"></script>
<script src="INHANCE_singleclick.jquery.js"></script>

2. Attach the plugin to a specific element.

$('#myBtn').on('sclick', function (evt) {
  evt.preventDefault();
});

Change log:

2017-05-20

  • added preventDefault() for touch devices

2017-05-05

  • added preventDefault() for touch devices

2017-02-21

  • refactorized to make use of $.event.special

2017-02-18

  • added 'tap' event.

2017-01-10

  • added 'target' parameter and changed method signatures

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