How to test an input value after inputing?

How to test an input value after inputing?

I have got an answer form jakecigar to test the existing value of input elements.

But how can I test value after the user changing the value of the input?

For example, if the user input value is "John", then the background color of the input change to red.