How to test an input value

How to test an input value


I want to test if a user input a certain value like “Jhon”, then change the background color,  I use the script below:
       $("input:contains('Jhon')").css("color", "red");


But it didn’t work! How can I do ?