Sometimes, we want to make an HTML button not submit form.
In this article, we’ll look at how to make an HTML button not submit form.
How to make an HTML button not submit form?
To make an HTML button not submit form, we can set the type
attribute to button
.
For instance, we write
<button type="button">My Button</button>
to set the button’s type
attribute to button
to make the button not submit the form it’s in.
Conclusion
To make an HTML button not submit form, we can set the type
attribute to button
.