How send a form with Javascript when input name is "submit"?
Solution 1:
Worth noting: It's often a lot easier to just change the input name to something other than "submit". Please use the solution below only if that's really not possible.
You need to get the submit
function from a different form:
document.createElement('form').submit.call(document.getElementById('redirectForm'));
If you have already another <form>
tag, you can use it instead of creating another one.
Solution 2:
Use submit()
method from HTMLFormElement.prototype
:
HTMLFormElement.prototype.submit.call(document.getElementById('redirectForm'));