Is there a way to use a loop to create 10 of these, incrementing everywhere that has a “1”
//1
$('#catbudgetform1').validate({
errorPlacement: function(error, element) {},
rules: {budgTotal1: { required: true, money:true }},
submitHandler:function() {
var theForm = $('#catbudgetform1');
updateSuccess(theForm,1);
},
invalidHandler: function(){
alert('Valid Number (ex. 1234 or 1234.00) is Required');
}
});
**notice #catbudgetform1 and budgTotal1 would need to be #catbudgetform2 and budgTotal2 and so on and so forth
OR is there a way to write this, that it would apply validation to each of the ten forms independently, but without writing it ten times?
I would try to do it only with classes, no ids, and in
submitHandleruse$(this).closest("form")instead of$("#catbudgetform1")