Correct TypeError: document.getElementById(...).submit is not a function - Javascript DOM

Javascript examples for DOM:Document getElementById

Description

Correct TypeError: document.getElementById(...).submit is not a function

Demo Code

ResultView the demo in separate window

<html>
   <head> 
      <script>
function formSubmit()//  w  w  w.  j a v a  2s.c  om
{
     document.getElementById('g_form').submit();    // Change the Id here
}

      </script> 
   </head> 
   <body> 
      <form action="class003.php" id="g_form" method="POST"> 
         <input type="text" name="f1" value=""> 
      </form> 
      <div id="web" onclick="formSubmit()">
         click
      </div>  
   </body>
</html>

Related Tutorials