Click here to Skip to main content
13,593,048 members
Rate this:
 
Please Sign up or sign in to vote.
See more:
I want to automatically click submit on this form when the page loads

<form role="form" accept-charset="UTF-8" method="post" action="https://FORMURL.com" novalidate="novalidate"> <div> </div> <div class="row k"> <input type="submit" value="I submitted my ID Docs" class="button button-style w"> </div> <span style="display: none;"></span> </form>


What I have tried:

I tried using this code but it requires a form ID and I do not have access to the form to include an ID.

<script type="text/javascript">
        window.onload = function () {
        document.Submit.click();
        }
    </script>
Posted 14-Jun-18 14:30pm
Updated 5 days ago
v2

1 solution

Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 1

If it's the only form on the page

document.getElementsByTagName("form")[0].submit();
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy | Cookies | Terms of Service
Web02-2016 | 2.8.180618.1 | Last Updated 15 Jun 2018
Copyright © CodeProject, 1999-2018
All Rights Reserved.
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100