-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
63 lines (63 loc) · 2.53 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>PincodeInput</title>
<link href="https://cdn.jsdelivr.net/npm/normalize.css@8.0.1/normalize.css" rel="stylesheet">
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC" crossorigin="anonymous">
<link href="dist/pincodeInput.min.css" rel="stylesheet">
<link rel="shortcut icon" href="https://carry0987.github.io/favicon.png" type="image/x-icon">
</head>
<body>
<div class="d-flex flex-column justify-content-center align-items-center">
<div id="app">
<h1 class="mb-3">PincodeInput</h1>
</div>
<!--//Number of selected images//-->
<div class="d-flex flex-row justify-content-center align-items-center">
<div class="d-flex flex-column justify-content-center align-items-center">
<h4>Input value : <span id="pincode-value"></span></h4>
</div>
</div>
<div class="d-flex justify-content-center">
<input type="text" id="pincode" class="form-control" placeholder="Enter pincode" />
</div>
</div>
<script src="dist/pincodeInput.min.js"></script>
<script type="text/javascript">
document.addEventListener('DOMContentLoaded', () => {
const pincodeInput = new PincodeInput('#pincode', {
autoFocus: true,
allowPaste: true,
secure: false,
forceDigits: true,
length: 6,
styles: {
'.pincode-grid': {
'margin': '5px',
'padding': '5px',
'width': '50px',
'text-align': 'center',
'text-align': 'center',
'line-height': 'normal',
'display': 'flex',
'align-items': 'center',
'justify-content': 'center'
},
'.pincode-grid.pincode-focus': {
'border-bottom': '5px solid #007bff'
}
},
onInput: (value, idx) => {
document.getElementById('pincode-value').innerText = value;
console.log(idx);
},
onComplete: (value) => {
console.log('Complete', pincodeInput.value);
}
});
});
</script>
</body>
</html>