Execute the "Submit Button" at the end of my Javascript program

I want to execute the “Submit Button” at the end of my Javascript program. How do I do that?

Assuming that the submit button is in a form and is an <input type=“button” … > with an onclick handler leading to your javascript, your last line after your checking will be formObject.submit(); where the formObject is an object reference to the form holding the button.

An example of AllanP’s answer

<form id="thisForm">
    <!-- do stuff -->
</form>


// do stuff
document.getElementById("thisForm").submit();