Reputation: 481
I have this JQuery function:
function CheckRequired() {
alert("test");
var ret = true;
$(".required").each( function() {
var check = $(this).val();
if(check == '') {
//alert($(this).attr("id"));
event.preventDefault();
ret = false;
}
});
if(!ret) {
alert("One or more fields cannot be blank");
return false;
}
}
which checks for all input fields with a class of required
i have many forms on on my site and i do not call this function on every form.
is there a way i can do this on every form submit without adding any extra code to each form?
Upvotes: 0
Views: 50