Created
March 16, 2011 21:05
-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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