JQuery, login/password fields


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



Copy this code and paste it in your HTML
  1. $(document).ready(function(){
  2.  
  3. // Form : login
  4. $("input[name=login]")
  5. .blur( function() { if ($(this).val() == '' || $(this).val() == 'login') $(this).css('color', '#999').val('login'); } )
  6. .focus( function() { if ($(this).val() == 'login') $(this).css('color', '#fff').val(''); } )
  7. .trigger('blur')
  8. ;
  9. // Form : password
  10. $("input[name=pass]")
  11. .blur( function() { if ($(this).val() == '' || $(this).val() == 'password') $(this).css('color', '#999').val('password'); } )
  12. .focus( function() { if ($(this).val() == 'password') $(this).css('color', '#fff').val(''); } )
  13. .trigger('blur')
  14. ;
  15.  
  16. } );

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.