1.0.0 • Published 2 years ago

@designly/jquery.onenter v1.0.0

Weekly downloads
-
License
ISC
Repository
github
Last release
2 years ago

jquery.onEnter.js

This plugin allows you to bind the enter key to an event with a callback, or to behave as a tab key (advance to next visible, enabled, writable form element) also with an optional callback.

Usage:

$('element').onEnter('tab'); // Catches enter key press, prevents form submit, and advances
                             // to next visible, enabled, writable form element (input, select, textarea, button)

$('element').onEnter('tab', function(element, args){
    // Do some stuff after tab
}, 'args to pass to callback');

$('element').onEnter(function(){
    // Do some stuff when enter key is pressed
});

Working Fiddle: https://jsfiddle.net/cloudulus/czb9L762/

1.0.0

2 years ago