Why does my page reload every time I click a link? How can I stop it? or Is there a way to prevent un

18 Replies, 2048 Views

Bro, I feel your pain. Page reloads are the worst.

Are you sure it’s not a form submission? Sometimes a `<button>` inside a `<form>` will trigger a page reload even if you don’t want it to.

Add `type="button"` to your button or use `e.preventDefault()` on the form’s submit event.

Also, check out MDN’s docs on event handling—super helpful for this stuff.

Messages In This Thread



Users browsing this thread: 1 Guest(s)