Javascript examples for jQuery Method and Property:submit
Stop form submit event
<!DOCTYPE html> <html> <head> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script> <script> $(document).ready(function(){ $("form").submit(function(event){ event.preventDefault();/* www. j a va 2 s . c om*/ console.log("Submit prevented"); }); }); </script> </head> <body> <form action=""> First name: <input type="text" name="FirstName" value="Bond"><br> Last name: <input type="text" name="LastName" value="Mary"><br> <input type="submit" value="Submit"> </form> </body> </html>