Skip to content

Instantly share code, notes, and snippets.

@awojtczyk
Created September 13, 2016 20:59
Show Gist options
  • 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