xxxxxxxxxx
1
<!-- Buttons trigger collapse -->
2
<a
3
class="btn btn-primary"
4
data-mdb-collapse-init
5
data-mdb-ripple-init
6
href="#collapseExample"
7
role="button"
8
aria-expanded="false"
9
aria-controls="collapseExample"
10
>
11
Link with href
12
</a>
13
<button
14
class="btn btn-primary"
15
type="button"
16
data-mdb-collapse-init
17
data-mdb-ripple-init
18
data-mdb-target="#collapseExample"
19
aria-expanded="false"
20
aria-controls="collapseExample"
21
>
22
Button with data-mdb-target
23
</button>
24
25
<!-- Collapsed content -->
26
<div class="collapse mt-3 p-3" id="collapseExample">
27
<select data-mdb-select-init>
28
<option value="1">One</option>
29
<option value="2">Two</option>
30
<option value="3">Three</option>
31
<option value="4">Four</option>
32
<option value="5">Five</option>
33
</select>
34
<label class="form-label select-label">Example label</label>
35
</div>
1
1
xxxxxxxxxx
1
const myCollapsible = document.getElementById('collapseExample')
2
myCollapsible.addEventListener('shown.mdb.collapse', () => {
3
document.querySelectorAll('#collapseExample .form-outline').forEach((formOutline) => {
4
new mdb.Input(formOutline).update();
5
});
6
})
Console errors: 0