xxxxxxxxxx
1
<div class="accordion" id="accordionExample">
2
<div class="accordion-item">
3
<h2 class="accordion-header" id="headingOne">
4
<button
5
class="accordion-button"
6
type="button"
7
data-mdb-toggle="collapse"
8
data-mdb-target="#collapseOne"
9
aria-expanded="true"
10
aria-controls="collapseOne"
11
>
12
Accordion Item #1
13
</button>
14
</h2>
15
<div
16
id="collapseOne"
17
class="accordion-collapse collapse show"
18
aria-labelledby="headingOne"
19
data-mdb-parent="#accordionExample"
20
>
21
<div class="accordion-body">
22
<div class="form-outline">
23
<input type="text" id="form1" class="form-control" value="There's a floating label"/>
24
<label class="form-label" for="form1">Example label</label>
25
</div>
26
</div>
27
</div>
28
</div>
29
<div class="accordion-item">
30
<h2 class="accordion-header" id="headingTwo">
31
<button
32
class="accordion-button collapsed"
33
type="button"
34
data-mdb-toggle="collapse"
35
data-mdb-target="#collapseTwo"
36
aria-expanded="false"
37
aria-controls="collapseTwo"
38
>
39
Accordion Item #2
40
</button>
41
</h2>
42
<div
43
id="collapseTwo"
44
class="accordion-collapse collapse"
45
aria-labelledby="headingTwo"
46
data-mdb-parent="#accordionExample"
47
>
48
<div class="accordion-body">
49
<div class="form-outline">
50
<input type="text" id="form1" class="form-control" value="There's a floating label"/>
51
<label class="form-label" for="form1">Example label</label>
52
</div>
53
</div>
54
</div>
55
</div>
56
<div class="accordion-item">
57
<h2 class="accordion-header" id="headingThree">
58
<button
59
class="accordion-button collapsed"
60
type="button"
61
data-mdb-toggle="collapse"
62
data-mdb-target="#collapseThree"
63
aria-expanded="false"
64
aria-controls="collapseThree"
65
>
66
Accordion Item #3
67
</button>
68
</h2>
69
<div
70
id="collapseThree"
71
class="accordion-collapse collapse"
72
aria-labelledby="headingThree"
73
data-mdb-parent="#accordionExample"
74
>
75
<div class="accordion-body">
76
<div class="form-outline">
77
<input type="text" id="form1" class="form-control" value="There's a floating label"/>
78
<label class="form-label" for="form1">Example label</label>
79
</div>
80
</div>
81
</div>
82
</div>
83
</div>
1
1
xxxxxxxxxx
1
document.addEventListener('shown.bs.collapse', () => {
2
document.querySelectorAll('.form-outline').forEach((formOutline) => {
3
mdb.Input.getInstance(formOutline).update();
4
});
5
})
6
Console errors: 0