Submit a form with submit() function - Javascript DOM HTML Element

Javascript examples for DOM HTML Element:Form

Description

Submit a form with submit() function

Demo Code

ResultView the demo in separate window

<html>
   <head></head>
   <body> 
      <form id="myForm"> 
         <input type="text"> 
         <!-- // www  .java2 s  .  com
         hide the submit button
         <input type="submit" value="Send" > --> 
         <input type="button" value="Send" onclick="onClick(this)"> 
      </form> 
      <script type="text/javascript">
            function onClick (e)
            {
                document.forms["myForm"].submit();
            }
        
      </script>  
   </body>
</html>

Related Tutorials