Skip to content

Commit 76d7099

Browse files
committed
Final commit for travel app
1 parent 2649029 commit 76d7099

File tree

2 files changed

+18
-4
lines changed

2 files changed

+18
-4
lines changed

travelRecommendation/index.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ <h1>IC Travel Recommendation</h1>
1515
<li><input type="text" id="destinationInput" placeholder="Enter a destination or keyword"> </li>
1616
<li>
1717
<button id='btnSearch'>Search</button>
18+
<button id="clearAllBtn">Clear All</button>
1819
</li>
1920

2021
</ul>

travelRecommendation/travel_recommendation.js

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
const report = document.getElementById("report");
22
const btnSearch = document.getElementById('btnSearch');
3-
const patients = [];
3+
const clearAllBtn = document.getElementById("clearAllBtn");
44

55

66
function searchCondition() {
@@ -13,8 +13,15 @@ function searchCondition() {
1313

1414
.then(data => {
1515
const country = data.countries.find(item => item.name.toLowerCase() === input);
16-
const temple = data.temples.find(item => 'temple' === input);
17-
const beach = data.beaches.find(item => 'beach' === input);
16+
17+
//array of words for temple search
18+
const templeArray = ["temple", "temples"];
19+
const temple = templeArray.some(word => word.toLowerCase() === input.toLowerCase());
20+
21+
22+
//array of words for beach search
23+
const beachArray = ["beach", "beaches"];
24+
const beach = beachArray.some(word => word.toLowerCase() === input.toLowerCase());
1825

1926
//search for country
2027
if (country) {
@@ -58,4 +65,10 @@ function searchCondition() {
5865
}
5966
btnSearch.addEventListener('click', searchCondition);
6067

61-
f
68+
function clearAllTasks() {
69+
const resultDiv = document.getElementById('result');
70+
resultDiv.innerHTML = '';
71+
input = '';
72+
73+
}
74+
clearAllBtn.addEventListener("click", clearAllTasks);

0 commit comments

Comments
 (0)