1.0.7 • Published 6 months ago

@berlinsms/code-picker v1.0.7

Weekly downloads
-
License
MIT
Repository
-
Last release
6 months ago

jQuery CodePicker

Homepage

Description

A jquery-plugin to pick a code or some digits in a formular, usful for OTP, TAN..

Usage

Download bsms-code-picker.js

https://static.berlinsms.de/toolsforcoder/code-picker/dist/bsms-code-picker.min.js

Include jquery.js and bsms-code-picker.js in -part of your page

<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
<script src="bsms-code-picker.min.js"></script>

Find your jquery-container and assign code-picker

$('.plugin-container').bsmsCodePicker();    

Make sure, the script is fully loaded, before you assign code-picker, e.g. use jquerys 'ready'

$(document).ready(function () {
    $('.plugin-container').bsmsCodePicker();
});    

Add options, if needed:

$(document).ready(()=>{
    $('.plugin-container').bsmsCodePicker( { nrOfBoxes:4 } );
});    

Example:

$(document).ready(function () {
    $('.plugin-container').bsmsCodePicker( { translate: {'I':'1','O':'0','l':'1'} } );
});    

Options

OptionDESCRIPTIONDEFAULT
nrOfBoxesHow many digits should be entered,6
allowedCharscharset for each digit,0123456789
inputNamename-attribute of a hidden input-tag, which the plugin includes to the formbsms-code
translateDictionary of key/value pairs, where keys are strings or regexp to be replaced in the user input, and values are strings or functions to be replaced with'\\w':c=>c.toUpperCase()
lastDigitEnteredcallback-function, which was called, when the last digit was entered, could be intrpreted as user finished input and used for precheck or form-submitnull
showCreditsshows creditstrue
1.0.7

6 months ago

1.0.6

6 months ago

1.0.5

6 months ago

1.0.4

7 months ago