Trouble displaying weather by zip code - Local Weather challenge

Trouble displaying weather by zip code - Local Weather challenge


I’m having some difficulty tracking down a bug in my Local Weather App. When I open the app in Firefox or Edge (Chrome wont play fair with the geolocation feature) the location will auto populate the location from the geolocation object in the browser. I implemented a feature that allows a person to type in a zip code and press a button to display the weather for that zip code. However if you use this feature, and after the weather is displayed, press either the C button to convert the temp to celsius, or the M button to display the barometric pressure in millibars, nothing happens. What I have found is that if you enter that same zip code a second time, then the two buttons will work. Not sure what the problem is, although I suspect it resides somewhere in my toggle button click events. Any help would be greatly appreciated. Thanks!

My app is at


U register more then once event handler for click
So every odd time, it works

Try with this:

$('#toggleTemp').on('click', function() {
      console.log('count: ' + (++globalV));

And just declare globalV in global scope

U will see when u again enter postcode, and click on toggle button, u get two logs in row…

This can be solved by detaching event handler and again attaching

Also u might want tidy your imports for css/js, see ur console for errors
and cache object if same postpone is searched multiple times