Created
March 7, 2010 00:22
-
-
Save charliepark/324038 to your computer and use it in GitHub Desktop.
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
<input type="text" class="text_field placeholder_content" | |
value="Default value" | |
onfocus=" | |
if (this.className == 'text_field placeholder_content') { | |
if (! this.getAttribute('default_value')) { | |
this.setAttribute('default_value', this.value); | |
} | |
this.value = ''; | |
this.className = 'text_field'; | |
} | |
" | |
onblur=" | |
if (! this.value) { | |
this.value = this.getAttribute('default_value'); | |
this.className = 'text_field placeholder_content'; | |
} | |
" | |
/> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment