tabto - focus to the next input when maxLength is hit
Auto-tabulation / focus for your HTML Form inputs.
Tiny helper that focus user on the next field when a field reach maxLength, like pressing Tab but without stealing the user ability to navigate, copy, paste, Shift+Tab...
<input id="one" data-tab-target="#two" maxlength="10" />
<input id="two" />
import tabto from '@jolicode/tabto';
tabto(document.getElementById('one'));
You can checkout a working demo here.
Install
$ yarn add @jolicode/tabto
$ npm i @jolicode/tabto
We ship multiple versions:
- CommonJS in
dist/index.js
; - UMD (Universal Module Definition) in
dist/browser.js
; - and ESM (ECMAScript) in
dist/index.es.js
.
Contributions
Build
$ yarn run build
Run linter
In our case, we use StandardJS rules.
$ yarn run lint
PS: The lint script will fix all autofixable problems.
Run tests
$ yarn run test
Publish
$ yarn run release