How can I detect when a form is submitted with pure Javascript? It would be the equivalent of this in jQuery
$('#form').submit(function(event){
alert('Meu callback');
event.preventDefault();
});
I was detecting when the user clicked on the submit
button, but I recalled that he could also hit enter for example.
Do I have to detect both actions? In this case, when the user clicks submit
and when you press the enter key?
Is it possible to achieve the effect just by checking if the form is being sent?