Posted By

hubbske on 02/09/12


Tagged

forms jquery logins


Versions (?)

Who likes this?

2 people have marked this snippet as a favorite

BrockSamsom
Priestd09


Adding input values and clearing on focus


 / Published in: jQuery
 

Adding input values and clearing on focus

  1. $('#ctl00_ctl05_ctl00_UserNameText').attr('value', 'username');
  2. $('#ctl00_ctl05_ctl00_UserNameText').focus(function() { if (this.value == 'username') {this.value = '';} });
  3. $('#ctl00_ctl05_ctl00_UserNameText').blur(function() { if (this.value == '') {this.value = 'username';} });
  4. $('#ctl00_ctl05_ctl00_PasswordText').attr('value', 'password');
  5. $('#ctl00_ctl05_ctl00_PasswordText').focus(function() { if (this.value == 'password') {this.value = '';} });
  6. $('#ctl00_ctl05_ctl00_PasswordText').blur(function() { if (this.value == '') {this.value = 'password';} });

Report this snippet  

You need to login to post a comment.