sni
smart-number-inputs
npm i smart-number-inputs
sni

smart-number-inputs

Increment/decrement number values in text inputs using up and down arrow keys.

by Martti Laine

1.1.2 (see all)License:MITTypeScript:Not Found
npm i smart-number-inputs
Readme

smart-number-inputs

Build Status

Increment/decrement number values in text inputs using up and down arrow keys.

Demo | NPM

Demo

Usage

Vanilla API:

smartNumberInputs.enable(DOMElement element);
smartNumberInputs.enable(DOMElement[] elements);
smartNumberInputs.enable(NodeList elements);
smartNumberInputs.enable(HTMLCollection elements);

Manually attaching the event handler to affect dynamically created inputs using jQuery:

$(document).on('keydown', 'input', smartNumberInputs.eventHandler);

NPM:

const smartNumberInputs = require('smart-number-inputs');

Running tests

npm test

Only unit tests:

npm run test:unit

Only browser tests:

npm run test:browser

Building

npm run build

Browser support

Sauce Test Status

Modern browsers.

Utilizes addEventListener (if using smartNumberInputs.enable) and DOMElement.setSelectionRange. Both of these can be polyfilled if support for ancient browsers is desired.

Credits

Built by @codeclown to be used in MailDeveloper.

Browser testing provided for free by Sauce Labs. Thanks!

License

MIT

Downloads/wk

14

GitHub Stars

20

LAST COMMIT

5yrs ago

MAINTAINERS

1

CONTRIBUTORS

1

OPEN ISSUES

0

OPEN PRs

1
VersionTagPublished
1.1.2
latest
5yrs ago
No alternatives found
No tutorials found
Add a tutorial

Rate & Review

100
No reviews found
Be the first to rate