Skip to content

Instantly share code, notes, and snippets.

@samg
Created June 17, 2009 04:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save samg/131086 to your computer and use it in GitHub Desktop.
Save samg/131086 to your computer and use it in GitHub Desktop.
// Search hint
$($('#q')[0]).addClass('search-hint');
$($('#q')[0]).val('Search');
$('#q').focus(function(){
if ($(this).val() == 'Search'){
$(this).removeClass('search-hint');
$(this).val('');
}
});
$('#q').blur(function(){
if ($(this).val() == ''){
$(this).addClass('search-hint');
$(this).val('Search');
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment