Default value for input fields

/ Published in: JavaScript
Save to your folder(s)

In regards to progressive enhancement, see also the [jQuery version](

Copy this code and paste it in your HTML
  1. onfocus="if(this.value == this.defaultValue){ this.value='' };" onblur="if(this.value == ''){ this.value=this.defaultValue };"

Report this snippet


RSS Icon Subscribe to comments

You need to login to post a comment.