Skip to content

Instantly share code, notes, and snippets.

@danilowm
Last active December 16, 2015 07:08
Show Gist options
  • Save danilowm/5396284 to your computer and use it in GitHub Desktop.
Save danilowm/5396284 to your computer and use it in GitHub Desktop.
Placeholder do HTML5 nos IEs
$(function(){
$('input[placeholder], textarea[placeholder]').each(function(){
var ph = $(this).attr('placeholder');
$(this).val(ph).focus(function(){
if( $(this).val() == ph ) $(this).val('')
})
.blur(function(){
if( !$(this).val() ) $(this).val(ph)
})
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment