Triggering the submit handler with jQuery - Javascript jQuery

Javascript examples for jQuery:Form Submit

Description

Triggering the submit handler with jQuery

Demo Code

ResultView the demo in separate window

<html>
 <head> 
  <script src="https://code.jquery.com/jquery-latest.min.js"></script> 
 </head> //w ww .  j av a 2  s  .c o  m
 <body> 
  <script>
$(function() {
  $('#target').submit(function() {
      console.log('Handler for .submit() called.');
      return false;
  });
});

      </script> 
  <form id="target" action="destination.html"> 
   <input type="text" value="Hello there"> 
   <input type="submit" value="Go"> 
  </form> 
  <div id="other">
    Trigger the handler 
  </div>  
 </body>
</html>

Related Tutorials