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

14th Nov 2022, 3:55 AM
Ayesha Moritano
Ayesha Moritano - avatar
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
14th Nov 2022, 4:06 AM
Ipang
+ 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!
14th Nov 2022, 4:29 AM
Ayesha Moritano
Ayesha Moritano - avatar