Default value for input fields


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

In regards to progressive enhancement, see also the [jQuery version](http://snipplr.com/view/48275/default-value-for-input-fields-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


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.