0
onSubmit=alert(0) Is Not Working Properly!
While debugging a page, I found out that the JavaScript code onSubmit is not working. I was wondering what is causing this error on the page, it seems to me like there is nothing to cause any trouble with my code. And quite I am confused because I couldnât understand the error its making, if someone smart could point my error I would gladly appreciate your help, thank you! https://code.sololearn.com/W0vA68i23Y13/?ref=app
2 Answers
+ 2
`onsubmit` is an event bound to a HTML form element. You applied it on a hidden input, thus the event never fires because the event is meant for the form
https://developer.mozilla.org/en-US/docs/Web/API/HTMLFormElement/submit_event
+ 1
Thatâs wonderful! It took me an hour to figure out, why the output is giving me headache. I thought itâs an error, it just a coding mistake. Thank you, stranger!