How can i submit a form automatically when the page loads at once.
my code below. just reloads the page
<form method="POST" id="formID">
<input type="text" name="item" value="food" />
</form>
<script>
window.addEventListener('DOMContentLoaded', (event) => {
document.getElementById('formID').submit(); });
</script>
New contributor
201 401 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.