When I go back and erase the data leaving the input field blank, the background does not go back to it's original color UNLESS I TYPE A "0".
I need the background color of the DIV to revert back to its original color when blank.
What am I doing wrong?
<script>
$(document).ready(function() {
$("#id").keypress(function() {
if ($("#id").val().length > 0) $("#in").css("background-color", "red");
else {
if ($("#id").val().length == 0) $("#in").css("background-color", "grey");
}
});
});
</script>
.lengtha second time? That's what theelseis for.