Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
Thread: Text box colour change
05-21-2012, 09:42 PM #1
- Join Date
- May 2012
- Thanked 0 Times in 0 Posts
Text box colour change
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, 10:01 PM #2
here's the cheap and nasty way to do it:
<input type="text" onkeyup="this.style.backgroundColor=this.value==3?'green':'red'" />