Search code examples
javascriptgoogle-chromefirefoxgreasemonkeytampermonkey

Clicking on form button without an <input>?


I am trying to click on the "Slow Download" button on this page, where the html is

<form action="https://nitroflare.com/view/A71F0994E20F2E0/security-privacy.jpg" method="post">
   <button id="slow-download" class="bootstrapButton" name="goToFreePage">Slow Download</button>
</form>

where I am doing

$( document ).ready(function() {
function   startFreeDownload(){
  getElementsById('slow-download')[0].submit();​
};
startFreeDownload();
});

All the posts I have seen have <input ... > which this one doesn't.

Question

Can someone tell me what I am doing wrong?


Solution

  • This solved the problem.

    function SkipId(objId){
        var oId = document.getElementById(objId);
        oId.click();
    }
    
    window.onload = function(){
        SkipId('slow-download');
    };