Skip to content

Instantly share code, notes, and snippets.

@claudiosanches
Created April 12, 2012 16:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save claudiosanches/2368908 to your computer and use it in GitHub Desktop.
Save claudiosanches/2368908 to your computer and use it in GitHub Desktop.
IE Placeholder
$(document).ready(function() {
// Placeholder para browsers antigos
// Importante usar o placeholder="" corretamente para o script rodar
$('input[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