try this :
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function () {
$("#typeColor").keyup(function () {
if ($("#typeColor").val().length == 0) {
$("#typeColor").css("background-color", "white");
return false;
}
$("#typeColor").css("background-color", "orange");
});
});
</script>
</head>
<body>
<input type="text" id="typeColor" name="typeColor" size="25" maxlength="20" />
</body>
</html>
Demo
The advantage of my sample is that you won't have to wait for page reload , it will change the color of input box instantly !