Posted By

mauricenaef on 09/08/09

Viewed 0 times

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


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.