Clear input field with jQuery

[javascript]
$("input").focus(function (){
if( this.value == this.defaultValue ) {
this.value = "";
}
}).blur(function() {
if( !this.value.length ) {
this.value = this.defaultValue;
}
});
[/javascript]

Leave a Reply