revision:
The onsubmit attribute fires when a form is submitted. Supported HTML tags: <form>
<element onsubmit="script"></element>
script: the script to be run on onsubmit.
When you submit the form, a function is triggered which alerts some text.
<p class="spec">When you submit the form, a function is triggered which alerts some text.</p> <form style="margin-left:3vw;" action="action_page.php" onsubmit="subFunction()"> <p class="spec">Enter name: <input type="text" name="fname"></p> <input type="submit" value="Submit"> </form> <p class="spec" style="margin-left:3vw;"id="idea-1"></p> <script> function subFunction() { alert("the form has been submitted"); } </script>
<form style="margin-left:3vw;" onsubmit = "easyGoing()"> <p class="spec"> First Name:<input type = "text" value = "" /><br/> Last Name:<input type = "text" value = ""/></p><br/> <input type = "submit" value = "Submit"/> </form> <script> function easyGoing() { alert("Form submitted successfully.") ; } </script>