| Level Navigation: 1 | 2 | 3 | 4 | 5 | Current Level: 6 | 7 | 8 | 9 | 10 |
Goal: Connect your weather data to the user interface using JavaScript.
setText() function to update span elementsIn your script.js, add this code below your POJO:
// Display weather data
setText("temp", newOrleansWeather.current_weather.temperature);
setText("wind", newOrleansWeather.current_weather.windspeed);
setText("code", newOrleansWeather.current_weather.weathercode);
setText(): Helper function that updates HTML elementsindex.html in your browserThis step brings your weather app to life by connecting the data (POJO) to the user interface (HTML). The setText() function dynamically updates the span elements with real weather information, transforming your static HTML into a dynamic, data-driven application. This demonstrates the fundamental concept of DOM manipulation and shows how JavaScript bridges the gap between data and display.
Ready for the next step? Continue to Step 7: Create Multi-City Weather Pages
| Level Navigation: 1 | 2 | 3 | 4 | 5 | Current Level: 6 | 7 | 8 | 9 | 10 |