-
Notifications
You must be signed in to change notification settings - Fork 0
/
veggies.html
58 lines (51 loc) · 1.51 KB
/
veggies.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>VEGGIES</title>
<link rel="stylesheet" href="veggies.css">
</head>
<body>
<div class="picture-container">
<img class="picture" src="veggies.png">
</div>
<div class="address">
Address: IIT Kharagpur, Kharagpur,<br>
West Bengal 721302
</div>
<input type="text" id="searchInput" placeholder="Search for a dish">
<ul id="searchResults"></ul>
<script>
const searchInput = document.getElementById('searchInput');
const searchResults = document.getElementById('searchResults');
const dishes = [
'Pizza',
'Burger',
'Pasta',
'Sushi',
'Salad',
'ice cream',
'coke'
];
searchInput.addEventListener('input', function() {
const searchTerm = searchInput.value.toLowerCase();
const filteredDishes = dishes.filter(dish => dish.toLowerCase().includes(searchTerm));
displaySearchResults(filteredDishes);
});
function displaySearchResults(results) {
searchResults.innerHTML = '';
if (results.length === 0) {
searchResults.innerHTML = '<li>No results found</li>';
return;
}
results.forEach(result => {
const li = document.createElement('li');
li.innerHTML = result;
searchResults.appendChild(li);
});
}
</script>
<textarea id="comments" placeholder="Enter your comments" rows="4" columns="50"></textarea>
</body>
</html>