Skip to content

Instantly share code, notes, and snippets.

@NathalieLarsson
Created March 8, 2012 16:20
Show Gist options
  • Save NathalieLarsson/2001867 to your computer and use it in GitHub Desktop.
Save NathalieLarsson/2001867 to your computer and use it in GitHub Desktop.
jQuery: Placeholder shim
$(document).ready(function(){
$('input,textarea').focus(function(){
$(this).parent().parent().find('label').hide();
});
$('input,textarea').blur(function(){
if($(this).val().length === 0){
$(this).parent().parent().find('label').show();
}
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment