How to submit a form using JavaScript by clicking a link?

Submit a form using JavaScript by clicking a link.

Team Leader Asked on June 18, 2017 in JAVASCRIPT.
Add Comment
1 Answer(s)
    
    <form name="f1" action="index.php">
    
    Enter text here: <input type='text' name='q' />
    
    <a href="javascript: Getdata()">Get Data</a>
    
    </form>
    
    <script type="text/javascript">
    
    function Getdata()
    
    {
    
    document.f1.submit();
    
    }
    
    </script>
    
    
    Team Leader Answered on June 21, 2017.
    Add Comment

    Your Answer

    By posting your answer, you agree to the privacy policy and terms of service.