Answer the question
In order to leave comments, you need to log in
How can I get the id of a submitted form?
I have multiple forms, how do I know which one was submitted?
<form action etc>
input
</form>
<form action etc>
input
</form>
var form = document.querySelectorAll('form');
for(var i=0;i<form.length;i++){
form[i].addEventListener('submit', validate, false);
}
function validate(){
...
};
Answer the question
In order to leave comments, you need to log in
It is possible, for example,
where a collection of forms is stored in document.forms , and this is the current form
Example
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question