jquery - form input focus in/out -
i have login forms, , if 1 sets email remembered, pre filled in email input. want that, if 1 clicks on email input, content (the actual email) fade, if clicks out, email show again. managed make email fade out,i don;t know hot restore old value on focus out. code:
$(document).ready(function () { $('input').focus(function() { $(this).val(""); }); $('input').focusout(function() { $(this).val(); }); });
any idea should value of focus out old remembered value (the email) appear there?
thanks!
i save "default" value in title attribute of field, can retrieved on blur:
$('.placeholder').live('focus', function() { if ( $(this).val() == $(this).attr('title') ) $(this).val(''); }); $('.placeholder').live('blur', function() { if ( $(this).val() == '' ) $(this).val($(this).attr('title')); });
Comments
Post a Comment