HomeThe ClassicsFarai's Codelab

How to prevent buttons from causing a form to submit with HTML

Published:

See How to prevent buttons from causing a form to submit with HTML on gomakethings.com

A while back, though, my friend Eric Bailey taught me a much simpler way to handle this: add type="button" to the button.

Much better than e.preventDefault.