5
How could I detect when a form is sent 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 clicks on the button submit
, but I remembered that it can also press enter for example.
Do I have to detect both actions? In case, when the user clicks submit
and when to press enter key?
It is possible to achieve the effect by just checking if the form is being sent?