I am making a website with ASP.NET Core 3.1 and I have a couple forms that are updating my database. Every row has their on form and every form has the class "dataFromMenu". I want one button that submits them all at the same time, I am using JS/JQuery to submit the forms, this is what Ive come up with:
function saveAllMenu() {
var temp = document.getElementsByClassName("dataFormMenu").length;
for (var i = 0; i < temp; i++) {
document.getElementsByClassName('dataFormMenu')[i].submit();
console.log(i);
}
}
When I run this nothing happens, If I switch the [i] to a 1 the first row gets switched and same for the others. But not with the [i], the console logs 0, 1, 2 on the button click.
Thanks beforehand! Best regards Max