Doing a form submit from HTML anchor - Javascript jQuery

Javascript examples for jQuery:Form Submit

Description

Doing a form submit from HTML anchor

Demo Code

ResultView the demo in separate window

<html>
 <head> 
  <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script> 
  <script type="text/javascript">
$(document).ready(function(e) {
$('#submit').click(function(e) {
    e.preventDefault();/*from   ww w  .  java2s  .co  m*/
    $('#formname').submit();
    return false;
});
});

      </script> 
 </head> 
 <body> 
  <form id="formname" action="p.php">
    // use you asp page 
   <input type="text"> 
  </form> 
  <a id="submit" href="javscript:void(0);"> Submit </a>  
 </body>
</html>

Related Tutorials