diff --git a/index.js b/index.js index 48ce2d7..527e511 100644 --- a/index.js +++ b/index.js @@ -5,6 +5,10 @@ const inputbox = document.querySelector("#inputbox") const weather = document.querySelector(".weather-ui") const getWeather = async(city) => { + if(city == ""){ + weather.innerHTML = '

City name is required

' + return; + } weather.innerHTML = `

Loading...

` const url = `https://api.openweathermap.org/data/2.5/weather?q=${city}&appid=${API_KEY}&units=metric` const response = await fetch(url);