Created
February 19, 2011 23:48
-
-
Save stresslimit/835520 to your computer and use it in GitHub Desktop.
jquery input.alt toggler [mostly replaced by input placeholder=""]
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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(){ | |
$(this).click(function(){ if(this.type=='submit') this.blur(); }); | |
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