Skip to content

Instantly share code, notes, and snippets.

@jkudish
Created October 8, 2010 21:00
Show Gist options
  • Save jkudish/617539 to your computer and use it in GitHub Desktop.
Save jkudish/617539 to your computer and use it in GitHub Desktop.
// will take the alt tags from all input fields and make it the default text
// default text will disappear on focus and reappear on blur if field is blank
$('input').each(function(){
if(this.alt){
this.value=this.alt;
this.onfocus=function(){if(this.value==this.alt)this.value=''}
this.onblur=function(){if(this.value=='')this.value=this.alt}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment