Look at the two following examples:
function myFunction() {
alert("The form was submitted");
}
<form onsubmit="myFunction()">
Enter name: <input type="text">
<input type="submit">
</form>
function myFunction() {
alert("The form was submitted");
}
<div onchange="myFunction()">
Enter name: <input type="text">
</div>
As you can see, the main difference between the two code snippets is the submit button which exist in the first snippet but omitted in the second one.
It can't be the only reason (submission button) to prefer the use of 'onsubmit' over the 'onchange' event. I mean, form element provides native form validation features which make it very powerfull tool for handling user input. Is there any reason at all to prefer the use of div (with onchange attr.) element over the form (with onsubmit attr.) element.
A few real world use cases will help me to build a solid and an intuitive understanding.