Trigger form submission with javascript

Update Nov 21, 2022

I would now recommend the requestSubmit() method. You can pass a submit button to it if you want. Its cleaner and can be intercepted.

document.getElementById("myForm").requestSubmit();

Original answer

A custom event works just fine.

document.getElementById("myForm").dispatchEvent(new CustomEvent('submit', {cancelable: true}));

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)