Clear Form Field

DescriptionJavascript snippet by - 03/14/10

This javascript clears the form field when the user clicks on it with the mouse.

Tags

<script type
="text/javascript">
 function clearMe(formfield){
  if (formfield.defaultValue==formfield.value)
   formfield.value = ""
 }
</script> 


<!--Just add this to your form field-->
onfocus="clearMe(this)"
  • Share
Submitted by: Adam J Nowak
http://hyperspatial.com

Comments and Feedback