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