Change Color on Entry into the TextBox

  1. <input type="text" id="textBoxVal" />  
  1. document.getElementById("textBoxVal").focus();  
  2. document.getElementById("textBoxVal").style.backgroundColor = "lightsalmon";  
  3.   
  4. $("#textBoxVal").keyup(function() {  
  5.  var inputVal = document.getElementById("textBoxVal").value;  
  6.         if (inputVal == "") {            document.getElementById("textBoxVal").style.backgroundColor = "lightsalmon";  
  7.         }  
  8.         else {  
  9.             document.getElementById("textBoxVal").style.backgroundColor = "white";  
  10.         }  
  11.   
  12.   
  13. });  
For more check the fiddle lik below:
http://jsfiddle.net/SurajMindfire/nx0to9gb/
This will surely help in use of selectors also.
Thanks