0

I loaded a page with an iframe inside a webpage of my site. Now, I need to auto click the button into the iframe, after the page is loaded.

The button code is:

<button type="button" id="submit-button" class="btn trusted-commit-payment">pay now!</button>

Can anyone tell me the code to do this?

Captain Obvlious
  • 18,863
  • 5
  • 39
  • 72
Pacman94
  • 1
  • 1
  • 3
  • Possible duplicate of [Click a button element on page load](http://stackoverflow.com/questions/21418915/click-a-button-element-on-page-load) – Siraj Alam Feb 26 '17 at 18:22

1 Answers1

0

I hope this will help.

Javascript

document.getElementById("myframe").addEventListener('load', function() {
            document.getElementById("submit-button").click();
  });

JQuery

$('iframe').on('load',function(){
    $('#submit-button').click();
});

Read this

Community
  • 1
  • 1
Siraj Alam
  • 7,620
  • 6
  • 46
  • 63