0 votes
in JavaScript by
How to submit a form using JavaScript by clicking a link?

1 Answer

0 votes
by

Let's see the JavaScript code to submit the form by clicking the link.

  1. <form name="myform" action="index.php">  
  2. Search: <input type='text' name='query' />  
  3. <a href="javascript: submitform()">Search</a>  
  4. </form>  
  5. <script type="text/javascript">  
  6. function submitform()  
  7. {  
  8.   document.myform.submit();  
  9. }  
  10. </script>  
...