@za-utils/input-number

0.0.10 • Public • Published

Simple number input

Install

npm install @za-utils/input-number

Usage

import InputNumber from '@za-utils/input-number';

const input = document.querySelector('input'); // your input node

const instance = new InputNumber(input); // creating instance

instance.setFixed(8); // can set max decimals precision
instance.setMin(0); // can set min amount value
instance.setMax(1000000000); // can set max amount value

// '12345' => amount (string or number)
// null => caret position (array of 2 items: [0, 1])
// true => save caret position (if current value 1234567890 and your set caret after 5, you can set value 1234567.890 caret will be seted after 5 )
instance.setValue('12345', null, true);

// graceful down
instance.destroy();

Package Sidebar

Install

npm i @za-utils/input-number

Weekly Downloads

0

Version

0.0.10

License

ISC

Unpacked Size

16.4 kB

Total Files

9

Last publish

Collaborators

  • zaycevdev