Onsubmit в HTML

<form onsubmit="myFunction()">
  Enter name: <input type="text">
  <input type="submit">
</form>

<script>
function myFunction() {
  alert("The form was submitted");
}
</script>
Undefined