4 ms·
Why do (almost) all the functions have event.preventDefault() ?
by jcun4128 6y ago
Why do (almost) all the functions have event.preventDefault() ?
- postalrat 6y agoThey are probably submit handlers on forms and they don't want the default form submit to happen.
- dgb23 6y agoNot on desktop right now to inspect. But this is typically the most compatible way to prevent standard anchor and button (or others) functionality. If you want the specific answer you could inspect where these handlers are attached to and then check the MDN documentation for default behavior.
- webninja 6y agoOne possible use is to prevent the standard right click menu from showing on desktop so that a custom right click menu can be shown instead.