Posted By

elightbo on 12/10/09


Tagged

textmate search input jquery


Versions (?)

jQuery proper search clear


 / Published in: Other
 

URL: http://bassistance.de/2007/01/23/unobtrusive-clear-searchfield-on-focus/

  1. $("#searchText").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  

You need to login to post a comment.