Return to Snippet

Revision: 42992
at March 14, 2011 23:05 by jimbo

Initial Code
function no_empty(field, text) {
	if( field.value == "")
		field.value = text;

/* call with an onblur event
 * example:
 * <input type="text" maxlength="24" onblur="no_empty(this, \'City\')" id="city" name="city" 
 *    value="City" />'

Initial URL

Initial Description
Often you supply a default value in a text field which you want to automatically clear when the user enters the field.  This will do that operation and fill the field with a default value.

Initial Title
Fill Any Empty HTML Field on Exit with a user supplied value

Initial Tags
form, html, validation

Initial Language