Is it possible to automatically push a button?

On the page is a form, once a visitor comes to the page - it is automatically sent to
<form action name="myform" method="post">
...
</form>
 <script type="text/javascript">document.forms.myform.submit();</script>


The shape has changed, it now has button:
<form action name="myform" method="post">
 <button id="btn">Button</button>
 </form>

Can the same what would the visitor goes to the page and the script he pressed a button?
June 3rd 19 at 20:24
2 answers
June 3rd 19 at 20:26
Solution
But what you are not satisfied with the decision just to do an Ajax request after the page has loaded? Press the button, but this is ridiculous crutches.
There after clicking the pop-up form appears, so the AJAX request is not needed immediately, the form should just show up.
Yes, I know that crutches, but then it was up to me nakosteen, and fix nothing. - shaniya commented on June 3rd 19 at 20:29
,
document.getElementById('btn').click(); - Lenny.Botsfo commented on June 3rd 19 at 20:32
June 3rd 19 at 20:28
Can

Find more questions by tags JavaScript