Posted By

mauricenaef on 09/08/09


Tagged

textmate input forms jquery searchfield


Versions (?)

Who likes this?

4 people have marked this snippet as a favorite

Flocke
vali29
jannisg
fenta23


Clear Input field on focus_js


 / Published in: jQuery
 

  1. $('.default-value').each(function() {
  2. var default_value = this.value;
  3. $(this).focus(function() {
  4. if(this.value == default_value) {
  5. this.value = '';
  6. }
  7. });
  8. $(this).blur(function() {
  9. if(this.value == '') {
  10. this.value = default_value;
  11. }
  12. });

Report this snippet  

You need to login to post a comment.