assets/script.js
//displays recent searches as buttons that the user can click to search that city
displays recent searches as buttons that the user can click to search that city
displays recent searches as buttons that the user can click to search that city
function renderSavedSearch() {
    searchHistoryEl.innerHTML = "";
    var inputData = JSON.parse(localStorage.getItem("cityInput")) || [];
    console.log(inputData);
    inputData.forEach(function (citySearched) {
        var cityBtn = document.createElement("button");
        cityBtn.classList.add("recent-searches");
        searchHistoryEl.appendChild(cityBtn);
        cityBtn.textContent = citySearched;
        cityBtn.addEventListener("click", function (event) {
            event.preventDefault();
            getWeather(event.target.textContent);
        });
    });
}
function renderSavedSearch ( ) { searchHistoryEl . innerHTML = "" ; var inputData = JSON . parse ( localStorage . getItem ( "cityInput" ) ) || [ ] ; console . log ( inputData ) ; inputData . forEach ( function ( citySearched ) { var cityBtn = document . createElement ( "button" ) ; cityBtn . classList . add ( "recent-searches" ) ; searchHistoryEl . appendChild ( cityBtn ) ; cityBtn . textContent = citySearched ; cityBtn . addEventListener ( "click" , function ( event ) { event . preventDefault ( ) ; getWeather ( event . target . textContent ) ; } ) ; } ) ; }
displays recent searches as buttons that the user can click to search that city
displays recent searches as buttons that the user can click to search that city