Skip to content

Instantly share code, notes, and snippets.

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 charliepark/324038 to your computer and use it in GitHub Desktop.
Save charliepark/324038 to your computer and use it in GitHub Desktop.
<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