Skip to content

Instantly share code, notes, and snippets.

@Lasha
Created April 12, 2013 03:48
Show Gist options
  • Save Lasha/5369183 to your computer and use it in GitHub Desktop.
Save Lasha/5369183 to your computer and use it in GitHub Desktop.
$('input[placeholder]').each(function()
{
var input = $(this);
$(input).val(input.attr('placeholder')).addClass('placeheld');
$(input).focus(function() {
if (input.val() == input.attr('placeholder'))
input.val('').removeClass('placeheld');
});
$(input).blur(function() {
if (input.val() == '' || input.val() == input.attr('placeholder'))
input.val(input.attr('placeholder')).addClass('placeheld');
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment