xxxxxxxxxx
1
<div class="form-outline mb-4">
2
<input type="text" class="form-control" id="datatable-search-input" />
3
<label class="form-label" for="datatable-search-input">Search</label>
4
</div>
5
<div class="datatable" id='datatable'>
6
<table>
7
<thead>
8
<tr>
9
<th class="th-sm">Actions</th>
10
<th class="th-sm">Title</th>
11
<th class="th-sm">Date</th>
12
</tr>
13
</thead>
14
<tbody>
15
<tr>
16
<td></td>
17
<td>one</td>
18
<td>date.one</td>
19
</tr>
20
<tr>
21
<td></td>
22
<td>two</td>
23
<td>date.two</td>
24
</tr>
25
<tr>
26
<td></td>
27
<td>three</td>
28
<td>date.three</td>
29
</tr>
30
<tr>
31
<td></td>
32
<td>four</td>
33
<td>date.four</td>
34
</tr>
35
</tbody>
36
</table>
37
</div>
1
1
xxxxxxxxxx
1
const instance = mdb.Datatable.getInstance(document.getElementById('datatable'))
2
3
document.getElementById('datatable-search-input').addEventListener('input', (e) => {
4
instance.search(e.target.value);
5
});
6
Console errors: 0