xxxxxxxxxx
1
<div id="basic" class="form-outline">
2
<input type="text" id="form11" class="form-control" />
3
<label class="form-label" for="form1">Example label</label>
4
</div>
5
6
<div class="form-outline">
7
<input type="text" id="anotherField" class="form-control" />
8
<label class="form-label" for="form1">Another field</label>
9
</div>
10
1
1
xxxxxxxxxx
1
const basicAutocomplete = document.querySelector('#basic');
2
const data = ['One', 'Two', 'Three', 'Four', 'Five'];
3
const dataFilter = (value) => {
4
return data.filter((item) => {
5
return item.toLowerCase().startsWith(value.toLowerCase());
6
});
7
};
8
9
new mdb.Autocomplete(basicAutocomplete, {
10
filter: dataFilter
11
});
Console errors: 0