Javascript examples for DOM HTML Element:Input Submit
When you submit the form, a function is triggered which alerts some text
<html> <head></head> <body> <form action="demo_form.asp" onsubmit="return myFunction()"> Enter name: /*from ww w . j av a 2 s .co m*/ <input type="text" name="fname"> <input type="submit" value="Submit"> </form> <script> function myFunction() { console.log("The form was submitted"); return false; } </script> </body> </html>