The onsubmit
attribute event is triggered when a form is submitted.
None.
<form onsubmit="script">
<form>, <keygen>
onsubmit |
Yes | Yes | Yes | Yes | Yes |
<!DOCTYPE html>
<html>
<body>
<!--from w w w .j a v a2s. c om-->
<form action="a.php" onsubmit="myFunction()">
Enter name: <input type="text" name="fname">
<input type="submit" value="Submit">
</form>
<script>
function myFunction() {
console.log("The form was submitted");
}
</script>
</body>
</html>