Posted By

binshtok on 07/04/10


Tagged

form


Versions (?)

Who likes this?

2 people have marked this snippet as a favorite

jackkeller
wattsupnow


Form default values


 / Published in: jQuery
 

URL: http://habrahabr.ru/blogs/jquery/98010/

  1. jQuery(document).ready(function(){
  2. $("input, textarea").focus(function(){
  3. if ($(this).attr("value") == $(this).attr("title"))
  4. $(this).attr("value", "")
  5. });
  6.  
  7. $("input, textarea").blur(function(){
  8. if ($(this).attr("value") == "")
  9. $(this).attr("value", $(this).attr("title"))
  10. });
  11. });

Report this snippet  

You need to login to post a comment.