News for hackers. Stuff that matters.
Re:HTML event handler attributes: down the rabbit hole by jbverschoor on Wednesday April 27, 2022 @04:36AM (#31177680)
I dunno. Why would you even try to use onclick instead of onsubmit. You’ll need to capture return keys, handle accessibility etc etc etc. It’s simply not the right thing to do.

Also. Onclick will simply execute the content as JavaScript. So if you’re not passing an argument, why would you expect an argument?

You can simply return false to prevent the defaults from happening.

The whole article has nothing to do with a rabbit hole. But more with a junior dev

Re:HTML event handler attributes: down the rabbit hole by idkwhoiam on Wednesday April 27, 2022 @05:37AM (#31178035)
He could also use FormData [1] to collect values from the form

[1] - https://developer.mozilla.org/en-US/docs/Web/API/FormData/Fo...

Re:HTML event handler attributes: down the rabbit hole by eatonphil on Wednesday April 27, 2022 @08:18AM (#31178969)
> Why would you even try to use onclick instead of onsubmit

I mentioned in the post I switched to onsubmit.

> But more with a junior dev

Damn, anyone can be a junior dev these days! :)