Skip to content

Instantly share code, notes, and snippets.

@ArupSen
Created April 2, 2014 18:20
Show Gist options
  • Save ArupSen/9939996 to your computer and use it in GitHub Desktop.
Save ArupSen/9939996 to your computer and use it in GitHub Desktop.
Add default text to form field. Text removed when field is focused but repopulated if nothing is entered and it loses focus.
function recall(thisfield, defaulttext) {
if (thisfield.value == "") {
thisfield.value = defaulttext;
}
}
// the following goes in the text input line
// onfocus="this.value= '';" onblur="recall(this,'Your email address');"
// change 'Your email address' to any default text
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment