File tree Expand file tree Collapse file tree 2 files changed +18
-4
lines changed
Expand file tree Collapse file tree 2 files changed +18
-4
lines changed Original file line number Diff line number Diff 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 >
Original file line number Diff line number Diff line change 11const report = document . getElementById ( "report" ) ;
22const btnSearch = document . getElementById ( 'btnSearch' ) ;
3- const patients = [ ] ;
3+ const clearAllBtn = document . getElementById ( "clearAllBtn" ) ;
44
55
66function 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}
5966btnSearch . 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 ) ;
You can’t perform that action at this time.
0 commit comments