Skip to content

Instantly share code, notes, and snippets.

@afeld
Created March 16, 2011 21:05
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 afeld/873299 to your computer and use it in GitHub Desktop.
Save afeld/873299 to your computer and use it in GitHub Desktop.
when the form is submitted, the form should submit empty values for the input elements with empty values
// note: this is not tested, but gives you the idea :-)
// for a normal html form:
$('form').submit(function(){
$(this).find('input.clear-input').each(function(i, elt){
// for each clear-input field
if ($(elt).val() === $(elt).initialValue()) {
// value has not changed
// empty the value
$(elt).val('');
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment