To make a form submit immediately your best bet is to bind a function to when the document has finished loading the DOM (HTML elements) and submit the form then:
document.addEventListener('DOMContentLoaded', function () {
const button = document.getElementById('sebutton');
button.click();
});
But I will also say that from looking at the code you're provided, I'm not sure what it is you're trying to achieve. If you're expecting the page to do some "counting" (incrementing a number when the form is submitted) then it's not going to work, once a form is submitted (without overriding the
onsubmit
event) then the page JS is going to stop working and the page will navigate. Just thought I'd mention this just in case!