Skip to content

Instantly share code, notes, and snippets.

@awojtczyk
Created September 13, 2016 20:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save awojtczyk/93ebf79c5c71a8cfeed0b89e1d36612a to your computer and use it in GitHub Desktop.
Save awojtczyk/93ebf79c5c71a8cfeed0b89e1d36612a to your computer and use it in GitHub Desktop.
jQuery / javaScript placeholders fix
$('input:text, textarea').each(function(){
var $this = $(this);
$this.data('placeholder', $this.attr('placeholder'))
.focus(function(){$this.removeAttr('placeholder');})
.blur(function(){$this.attr('placeholder', $this.data('placeholder'));
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment