Default search value clear


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



Copy this code and paste it in your HTML
  1. $("#keywords").focus(function() {
  2. if( this.value == this.defaultValue ) {
  3. this.value = "";
  4. }
  5. }).blur(function() {
  6. if( !this.value.length ) {
  7. this.value = this.defaultValue;
  8. }
  9. });

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.