View Full Version : Text box colour change

05-21-2012, 08:42 PM
Hi there just wondering if its possible to make a text box in java script and then for that box 2 change colour when the user inputs something. For example if they enter 3 it will turn green but if they enter anything else then it will turn red.

05-21-2012, 09:01 PM
here's the cheap and nasty way to do it:

<input type="text" onkeyup="this.style.backgroundColor=this.value==3?'green':'red'" />

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum