jquery prevent form submit if field empty code example
Example 1: jquery check if input is empty on submit
var empty = true;
$('input[type="text"]').each(function() {
if ($(this).val() != "") {
empty = false;
return false;
}
});
Example 2: jquery don't empty specific form field after submit
form.find('textarea,input,select').not('input[name="INPUT_NAME_1"],input[name="INPUT_NAME_2"]').val('');