Cancel submit event by returning false : Form Submit « jQuery « JavaScript DHTML






Cancel submit event by returning false

   


<html>
  <head>
    <script type="text/javascript" src="js/jquery-1.3.2.js"></script>
    <script type="text/javascript">
        $(document).ready(function(){
        
            $("form").submit(function() {
                alert("submit");
                  return false;
            });


        });
    </script>
  </head>
  <body>
    <body>
    <form action="javascript:alert('success!');">
        <div>
          <input type="text" />
          <input type="submit" />
        </div>
     </form>

     <div></div>


    </body>
</html>

   
    
    
  








Related examples in the same category

1.Turn off submit action
2.Submit event
3.To trigger the submit event on the first form on the page
4.Validate form and output message