Get your own website Result Size: 625 x 565
x
 
<!DOCTYPE html>
<html>
<body>
<p>When you submit the form, a function is triggered which alerts some text.</p>
<form action="https://www.w3schools.com/action_page.php" onsubmit="myFunction()">
  Enter name: <input type="text" name="fname">
  <input type="submit" value="Submit">
</form>
<script>
function myFunction() {
  alert("The form was submitted");
}
</script>
</body>
<!-- Mirrored from www.w3schools.com/tags/tryit.asp?filename=tryhtml5_ev_onsubmit by HTTrack Website Copier/3.x [XR&CO'2014], Wed, 21 Dec 2022 17:34:18 GMT -->
</html>