HTML
xxxxxxxxxx
1
<section class="intro">
2
<div class="bg-image h-100" style="
3
background-image: url(https://mdbootstrap.com/img/Photos/new-templates/search-box/img4.jpg);
4
">
5
<div class="mask d-flex align-items-center h-100" style="background-color: rgba(194, 185, 179, 0.2);">
6
<div class="container">
7
<p class="h1 mb-4 mb-md-5 text-dark text-uppercase text-center">Search hotel</p>
8
<div class="card" style="background-color: rgba(0,0,0,.7);">
9
<div class="card-body p-4">
10
<div class="row justify-content-center">
11
<div class="col-lg-12 col-xl-10 d-lg-flex flex-row mb-lg-4 mb-xl-0">
12
13
<div id="basic" class="form-outline form-white flex-fill me-lg-2 mb-3 mb-lg-0">
14
<input type="text" id="form1" class="form-control" />
15
<label class="form-label" for="form1">What are you looking for?</label>
16
</div>
17
18
<div class="form-outline datepicker form-white flex-fill mx-lg-2 mb-3 mb-lg-0" data-mdb-toggle-button="false">
19
<input type="text" class="form-control" id="exampleDatepicker1" data-mdb-toggle="datepicker" />
20
<label for="exampleDatepicker1" class="form-label">Arrival date</label>
21
</div>
22
23
<div class="form-outline datepicker form-white flex-fill mx-lg-2 mb-3 mb-lg-0" data-mdb-toggle-button="false">
24
<input type="text" class="form-control" id="exampleDatepicker2" data-mdb-toggle="datepicker" />
25
<label for="exampleDatepicker2" class="form-label">Departure date</label>
26
</div>
27
28
<div id="location" class="form-outline form-white flex-fill ms-lg-2 mb-4 mb-lg-0">
29
<input type="text" id="form2" class="form-control" />
30
<label class="form-label" for="form2">Number of guests</label>
31
</div>
32
33
</div>
34
<div class="col-lg-12 col-xl-2">
35
<input class="btn btn-primary btn-rounded btn-block" type="submit" value="Search" />
36
</div>
37
</div>
38
</div>
39
</div>
40
</div>
41
</div>
42
</div>
43
</section>
CSS
xxxxxxxxxx
1
html,
2
body,
3
.intro {
4
height: 100%;
5
}
JS
xxxxxxxxxx
1
const basicAutocomplete = document.querySelector('#basic');
2
const data = ['Museum', 'Party', 'Restaurant', 'Concert', 'Architecture'];
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
});
12
13
const locationAutocomplete = document.querySelector('#location');
14
const dataL = ['1 adult', '2 adults', '3 adults', '2 adults and 1 child', '2 adults and 2 children'];
15
const dataFilterL = (value) => {
16
return dataL.filter((item) => {
17
return item.toLowerCase().startsWith(value.toLowerCase());
18
});
19
};
20
21
new mdb.Autocomplete(locationAutocomplete, {
22
filter: dataFilterL
23
});
Console errors: 0