Skip to content
Advertisement

Cant override the color with javascript

i want to make the color of the number green if its more than zero to make it green and want to be red when its below zero but i cant do it i dont get why can anyone explain

JavaScript

Advertisement

Answer

The order in your code is not correct. You must get an element after it is added to DOM.

Try the snippet.

JavaScript
JavaScript
JavaScript
User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement