How do I select text contents parent to add class list to it?
I am using this method to change the text content based on what the api value returned is.
It is being used in this mark up
I am trying to add a class list that will change its text color based on either what is returned or its new text content.
In the airQuality method is it possible to select the owner of the text content to use classList.add() to it?
https://github.com/bsupinski/weather_app
GitHub
GitHub - bsupinski/weather_app
Contribute to bsupinski/weather_app development by creating an account on GitHub.
7 Replies
I assume this markup of yours is created through JavaScript? If so, why not follow the same method of using string interpolation?
and use an inline style?
Sure, why not?
oh wait i could just use the same method and have it add its returned value as a class name
is it a big deal to have a class name starting with a capitalized letter?
I don't think so, but you can also run toLowerCase on it first.
Thank you, I definitely over thought that problem.
Nice 👍