Y
Hacker News
new
|
ask
|
show
|
jobs
by
MortyWaves
340 days ago
Is there a reason you literally simulate a click event on the form instead of calling submit() on it?
2 comments
Mystery-Machine
340 days ago
`requestSubmit()`*
https://developer.mozilla.org/en-US/docs/Web/API/HTMLFormEle...
link
rorylaitila
340 days ago
Yeah, it's escaping me at the moment all of the reasons, but calling .submit() on a form element doesn't exactly have all of the behaviors as calling .click() on a button element in a form, particularly multiple buttons in a form.
link
hapidjus
340 days ago
Are you perhaps using the button name/value for something? Havent tested but i suspect that submit() does not pass that right?
link
rorylaitila
340 days ago
Yep that's one reason. I make heavy use of that.
link
https://developer.mozilla.org/en-US/docs/Web/API/HTMLFormEle...