Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/thomasdev-de/jquery-typingevents

The jQuery plugin simplifies the events that take place in an input field. The default properties are not overwritten.
https://github.com/thomasdev-de/jquery-typingevents

delay events javascipt javascript jquery jquery-plugin typing

Last synced: 6 days ago
JSON representation

The jQuery plugin simplifies the events that take place in an input field. The default properties are not overwritten.

Awesome Lists containing this project

README

        

# jquery-typingEvents

The jQuery plugin simplifies the events that take place in an input field. The default properties are not overwritten.

## options

| name | type | default | description |
|---------------|----------|-------------------------------|------------------------------------------------------------------------------------------------------|
| delay | int | `400` | The time in milliseconds after the last keystroke was made and the event `typingEnd` is triggered. |
| allowedKeys | array | `[]` | A list for allowed keys (e.g. `['a','b',..]`) |
| preventedKeys | array | `[]` | A list for forbidden keys (e.g. `['a','b',..]`) |
| trim | string | `".,\|]\\^"` | Characters that are trimmed from the input after the event `typingEnd` (except for password fields). |
| onKeyDown | function | `(event, key, allowed) => {}` | The function is triggered with each keystroke. |
| onKeyUp | function | `(key) => {}` | The function is triggered each time a keystroke is released. |
| onPrevented | function | `(key) => {}` | The function is triggered when the keystroke is not allowed. |
| onTypingStart | function | `() => {}` | The function is triggered when an input starts. |
| onTypingEnd | function | `(value) => {}` | The function is triggered when an input ends (measured by the `delay` property). |

## events

| event | params | |
|-----------------------------------------------------------|--------------------|----------------------------------------------------------------------|
| key.any | e, key, allowed | Triggered with each keystroke. |
| kex.A
key.a
key.B
key.b
key.Shift
... | e, key, allowed | Triggered on each specific keystroke. |
| key.prevented | e, key | Triggered on each forbidden keystroke. |
| typingStart | e | Triggered at the start of the input. |
| typingEnd | e, value (trimmed) | Triggered at the end of the input (measured by the `delay property). |