Skip to content

Instantly share code, notes, and snippets.

@simontabor
Created May 13, 2012 16:01
Show Gist options
  • Save simontabor/2689048 to your computer and use it in GitHub Desktop.
Save simontabor/2689048 to your computer and use it in GitHub Desktop.
Replaces all placeholders with values if placeholders aren't supported by the browser.
if (!Modernizr.input.placeholder) {
$('input').each(function() {
if ((!($(this).val())) && ($(this).attr('placeholder'))) {
$(this).val($(this).attr('placeholder'));
$(this).attr('onclick','this.value = ""');
}
})
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment