Advertisement
Guest User

Untitled

a guest
Dec 22nd, 2014
153
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.71 KB | None | 0 0
  1.  
  2. var inputs = {};
  3.  
  4. jQuery('.gfield input, .gfield textarea' ).each( function(){
  5.  
  6. var _id = jQuery( this ).attr('id');
  7. var _string = jQuery( this ).val();
  8.  
  9. inputs[_id] = _string;
  10.  
  11. });
  12.  
  13.  
  14. jQuery('.gfield input, .gfield textarea').click(function(){
  15.  
  16. var _id = jQuery( this ).attr('id');
  17. var value = jQuery( this ).val();
  18. if( value == inputs[ _id ] ){
  19. jQuery( this ).val('');
  20. }
  21.  
  22. });
  23.  
  24. jQuery( '.gfield input, gfield textarea').blur( function(){
  25.  
  26. var _id = jQuery( this ).attr('id');
  27. var value = jQuery( this ).val();
  28.  
  29. if( value == '' ){
  30. jQuery( this ).val( inputs[ _id ] );
  31. }
  32.  
  33. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement