Skip to content

Instantly share code, notes, and snippets.

@kiennt2
Created September 2, 2013 08:12
Show Gist options
  • Save kiennt2/6410384 to your computer and use it in GitHub Desktop.
Save kiennt2/6410384 to your computer and use it in GitHub Desktop.
input clearText : onblur - onfocus
function clearText(field){
if (field.defaultValue == field.value) field.value = '';
else if (field.value == '') field.value = field.defaultValue;
//<input type="text" onblur="clearText(this)" onfocus="clearText(this)" value="value"/>
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment