Sometimes, we want to make an HTML button not reload the page.
In this articlem, we’ll look at how to make an HTML button not reload the page.
How to make an HTML button not reload the page?
To make an HTML button not reload the page, we add a button or set the input’s type attribute to button
.
For instance, we write
<button>click</button>
to add a button or
<input type="button" />
to add an input with type attribute to button
.
Conclusion
To make an HTML button not reload the page, we add a button or set the input’s type attribute to button
.