That’s my Local Weather App link: Local Weather App
I’m trying to get the current metric value (Fahrenheit or Celsius) inside a element that was dynamically set by the first call of the getWeather() function. I would like to get the current value to compare if it’s F or C and then change it.
I’ve already tried to get the current value with the following methods:
- $(’#unit’).val() - Returns empty
- $(’#unit’).text() - Returns empty
- $(’#unit’).html() - Returns empty
- $(’#unit’).innerHTML - Returns undefined
- $(’#unit’).innerText - Returns undefined
I’m not sure how to get the current value inside the unit element. I think that perhaps it’s because the value is dynamically defined, but I’m not sure. I did some research about it but I couldn’t find an answer to why it’s always returning empty or undefined.
Thank you all in advanced for your help.