Why does the page refresh when I click 'submit'?

Are you making an HTML form, and the page refreshes/reloads when you submit the form? You can prevent this with a little bit of JavaScript:

<form onsubmit="(event) => event.preventDefault()">
    <p>...</p>
</form>

The preventDefault method prevents the page from refreshing!

Show Comments

Get the latest posts delivered right to your inbox.