Skip to content

Instantly share code, notes, and snippets.

@claudiosanches
Created August 2, 2012 17:42
Show Gist options
  • Save claudiosanches/3239028 to your computer and use it in GitHub Desktop.
Save claudiosanches/3239028 to your computer and use it in GitHub Desktop.
Placeholder support
jQuery(document).ready(function($) {
$('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