🔔 Alert..!! Get 2 Month Free Cloud Hosting With $200 Bonus From Digital Ocean ACTIVATE DEAL

double-keypress is a useful jQuery plugin which can be used to detect and handle Doube Keypress event in your webpage. Supports both keydown and keyup events.

callback Keyboard

Documentation

jquery.double-keypress

A jQuery plugin to manage double keypress.

Requirements

Installation

Using bower is the simplest way.

bower install jquery.double-keypress --save-dev 

Usage

Simple Way

$(function(){  	var keyCode = 16;   // means SHIFT key (and means any if null)  	$('body').dbKeypress(keyCode, function(e){  		alert('SHIFT key was double-pressed');  	});  }); 

with Options

$(function(){      var keyCode = 16;     var options = {          eventType: 'keydown',   // Optional (keydown or keyup)         interval: 350,          // Optional (milliseconds)         callback: function(e){              alert('SHIFT key was double-pressed');          }      };     $('body').dbKeypress(keyCode, options);  }); 

Multiple keyCodes

$('body').dbKeypress([16, 17], function(e){      if(e.keyCode == 16) {          alert('SHIFT key was double-pressed');      } else if(e.keyCode == 17) {          alert('CTRL key was double-pressed');      }  }); 

About KeyCode

See here

Contributor

sdavidg

License

This package is licensed under the MIT License.

Copyright 2015 Sukohi Kuhoh


You May Also Like