xxxxxxxxxx
1
<hr class="mt-4">
2
<label for="inp_1" class="form-label fs-5">Not Working (but i fixed it :))</label>
3
<input id="inp_1"
4
type="tel"
5
name="dtaFld_6"
6
value="(727) 123-4567"
7
class="form-control form-control-lg fs-4 inputMask active input-mask-fixed"
8
placeholder="(999) 999-9999"
9
data-mdb-input-placeholder="false"
10
data-mdb-input-mask="(999) 999-9999">
11
12
<button class="btn show-value-btn">
13
Show me the value!
14
</button>
15
<hr>
16
17
<label for="inp_2" class="form-label fs-5">Working Without inputMask</label>
18
<input id="inp_2"
19
type="tel"
20
name="dtaFld_6"
21
value="(727) 123-4567"
22
class="form-control form-control-lg fs-4"
23
placeholder="(999) 999-9999">
24
25
<hr>
26
<label for="inp_3" class="form-label fs-5">Testing ZipCode with inputMask</label>
27
<input id="inp_3"
28
type="text"
29
name="zip"
30
value="12345-1234"
31
class="form-control form-control-lg fs-4 inputMask active"
32
placeholder="99999-9999"
33
data-mdb-input-mask="99999-9999">
34
<hr>
35
<label for="inp_4" class="form-label fs-5">Testing ZipCode without inputMask</label>
36
<input id="inp_4"
37
type="text"
38
name="zip"
39
value="12345-1234"
40
class="form-control form-control-lg fs-4"
41
placeholder="99999-9999">
1
1
xxxxxxxxxx
1
const showValueBtn = document.querySelector('.show-value-btn');
2
const inputMaskFixed = document.querySelector('.input-mask-fixed');
3
4
showValueBtn.addEventListener('click', () => {
5
alert(`That's the current value: ${inputMaskFixed.value}`)
6
})
Console errors: 0