How to apply style to input, if the entered text, and the focus is not received?

I tried to use focus, but when the mouse is removed, the color changes and the text that is
July 8th 19 at 12:05
1 answer
July 8th 19 at 12:07
Solution
Hang event like onchange, it will check that if value is not empty then add a class, otherwise remove

https://jsfiddle.net/gangstarcj/6kbh7afx/
And with CSS don't like? - Muriel32 commented on July 8th 19 at 12:10
: https://jsfiddle.net/gangstarcj/6kbh7afx/ C by using css like in any way - Mabel commented on July 8th 19 at 12:13
If so https://jsfiddle.net/gangstarcj/6kbh7afx/2/ - Mabel commented on July 8th 19 at 12:16

Find more questions by tags CSSHTML