-
Notifications
You must be signed in to change notification settings - Fork 0
/
script.js
43 lines (37 loc) · 1.45 KB
/
script.js
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
document.querySelector('.card-number-input').oninput = (e) => {
document.querySelector('.card-number-box').innerText =
document.querySelector('.card-number-input').value
document.querySelector('.card-number-input').value
e.target.value = e.target.value
.replace(/[^\dA-Z]/g, '')
.replace(/(.{4})/g, '$1 ')
.trim()
}
document.querySelector('.card-holder-input').oninput = () => {
document.querySelector('.card-holder-name').innerText =
document.querySelector('.card-holder-input').value
}
document.querySelector('.month-input').oninput = () => {
document.querySelector('.exp-month').innerText =
document.querySelector('.month-input').value
}
document.querySelector('.year-input').oninput = () => {
document.querySelector('.exp-year').innerText =
document.querySelector('.year-input').value
}
document.querySelector('.cvv-input').onmouseenter = () => {
document.querySelector('.front').style.transform =
'perspective(1000px) rotateY(180deg)'
document.querySelector('.back').style.transform =
'perspective(1000px) rotateY(0deg)'
}
document.querySelector('.cvv-input').onmouseleave = () => {
document.querySelector('.front').style.transform =
'perspective(1000px) rotateY(0deg)'
document.querySelector('.back').style.transform =
'perspective(1000px) rotateY(180deg)'
}
document.querySelector('.cvv-input').oninput = () => {
document.querySelector('.cvv-box').innerText =
document.querySelector('.cvv-input').value
}