logo

Prevent form from submitting

May 6, 2021

Let's say you have a form and you want to prevent the user from submitting the form accidentally when using a keyword. We can use a button element with a type of button. In this case, the button does nothing when pressed by default.

Your JS is turned off. Please turn it on to see the CodePen. Here's a screenshot from the Pen

Try reload the page, our check out the pen on CodePen.