On the Yahoo weather website, there is a select element which could be retrieved by:
let sel = document.querySelector('select');
You can manually select different options (Temperature, Wind, and Precipitation) and see the next 24-hour forecast for each one. The problem is that when you change the option programmatically (as below), although the selected option changes, the onChange event not triggers (i.e., forecasts not update):
sel.selectedIndex = 1;
sel.selectedIndex = 2;
I've tested different solutions prepared on similar threads (like this one and this one), but unfortunately non of them works. Any helps would be appreciated in advance.
change()event is not triggered automatically, you need to trigger it, assel.change();after setting theselectedIndexsel.change()orsel.onchange()returns this error: Uncaught TypeError: sel.onchange is not a function.