xxxxxxxxxx
1
<div class="accordion" id="accordionExample">
2
<div class="accordion-item">
3
<h2 class="accordion-header" id="headingOne">
4
<button
5
data-mdb-collapse-init
6
class="accordion-button"
7
type="button"
8
data-mdb-target="#collapseOne"
9
aria-expanded="true"
10
aria-controls="collapseOne"
11
>
12
Accordion Item #1
13
</button>
14
</h2>
15
<div id="collapseOne" class="accordion-collapse collapse show" aria-labelledby="headingOne" data-mdb-parent="#accordionExample">
16
<div class="accordion-body">
17
<strong>This is the first item's accordion body.</strong> It is hidden by default,
18
until the collapse plugin adds the appropriate classes that we use to style each
19
element. These classes control the overall appearance, as well as the showing and
20
hiding via CSS transitions. You can modify any of this with custom CSS or
21
overriding our default variables. It's also worth noting that just about any HTML
22
can go within the <strong>.accordion-body</strong>, though the transition does
23
limit overflow.
24
</div>
25
</div>
26
</div>
27
<div class="accordion-item">
28
<h2 class="accordion-header" id="headingTwo">
29
<button
30
data-mdb-collapse-init
31
class="accordion-button collapsed"
32
type="button"
33
data-mdb-target="#collapseTwo"
34
aria-expanded="false"
35
aria-controls="collapseTwo"
36
>
37
Accordion Item #2
38
</button>
39
</h2>
40
<div id="collapseTwo" class="accordion-collapse collapse" aria-labelledby="headingTwo" data-mdb-parent="#accordionExample">
41
<div class="accordion-body">
42
<div class="form-outline mt-4" data-mdb-input-init>
43
<input
44
class="form-control bg-white"
45
id="formControlReadonly"
46
type="text"
47
value="Readonly input here..."
48
aria-label="readonly input example"
49
readonly
50
/>
51
<label class="form-label" for="formControlReadonly">Readonly</label>
52
</div>
53
</div>
54
</div>
55
</div>
56
</div>
57
1
1
xxxxxxxxxx
1
const accordion = document.getElementById('accordionExample')
2
accordion.addEventListener('shown.mdb.collapse', ()=> {
3
document.querySelectorAll('.form-outline').forEach((formOutline) => {
4
new mdb.Input(formOutline).update();
5
});
6
})
Console errors: 0