Guest User

Untitled

a guest
Nov 24th, 2017
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.38 KB | None | 0 0
  1.  
  2. var clearMePrevious = '';
  3.  
  4. // clear input on focus
  5. $('.clearMeFocus').focus(function()
  6. {
  7. if($(this).val()==$(this).attr('title'))
  8. {
  9. clearMePrevious = $(this).val();
  10. $(this).val('');
  11. }
  12. });
  13. // if field is empty afterward, add text again
  14. $('.clearMeFocus').blur(function()
  15. {
  16. if($(this).val()=='')
  17. {
  18. $(this).val(clearMePrevious);
  19. }
  20. });
  21. });
Add Comment
Please, Sign In to add comment