File tree Expand file tree Collapse file tree 1 file changed +6
-0
lines changed Expand file tree Collapse file tree 1 file changed +6
-0
lines changed Original file line number Diff line number Diff line change @@ -4,6 +4,7 @@ const apiKey = "e3a46268fdc2475cb63214712240202";
4
4
const cityName = document . getElementById ( "city-name" ) ;
5
5
const dateTime = document . getElementById ( "date-time" ) ;
6
6
const condition = document . getElementById ( "condition" ) ;
7
+ const condition2 = document . getElementById ( "condition2" ) ;
7
8
const temp = document . getElementById ( "temp" ) ;
8
9
const humidity = document . getElementById ( "humidity" ) ;
9
10
const country = document . getElementById ( "country" ) ;
@@ -28,6 +29,10 @@ const updateWeatherInfo = (result) => {
28
29
country . innerText = `${ result . location . country } ` ;
29
30
dateTime . innerText = `${ result . location . localtime } ` ;
30
31
temp . innerText = `${ result . current . temp_c } °C` ;
32
+ humidity . innerText = `${ result . current . humidity } %` ;
33
+ condition . innerText = `${ result . current . condition . text } ` ;
34
+ condition2 . innerText = `${ result . current . condition . text } ` ;
35
+ icon . src = `${ result . current . condition . icon } ` ; // Set the src attribute of the img tag with id "icon"
31
36
} ;
32
37
const getData = async ( cityName ) =>
33
38
fetchData (
@@ -57,6 +62,7 @@ btn.addEventListener("click", async () => {
57
62
const { value } = input ;
58
63
const result = await getData ( value ) ;
59
64
updateWeatherInfo ( result ) ;
65
+ console . log ( result ) ;
60
66
} catch ( error ) {
61
67
cityName . innerText = "Error to fetch weather" ;
62
68
}
You can’t perform that action at this time.
0 commit comments