Prevent default event

Prevent default event in JavaScript — with the four heights of help laid out: do it now, make it easier for the next person to accept, work out the right move when you are stuck, and learn the pattern so it stops coming back.

4prompt heights
Open it in the interactive atlas →

The four heights

The same task, four distances: today's deadline, the next reviewer, the stuck moment, the pattern.

Execute — do the immediate task

+
On the checkout form, stop the default submit so I can run validation first. Prevent the browser's…
On the checkout form, stop the default submit so I can run validation first. Prevent the browser's submit behavior on the submit button, call validateCheckout, and only call form.submit when validation passes. Do this before 5pm on Friday for the release.

Improve — make it easier to accept

+
Before I hand this to the payments reviewer, make the prevention clear: surface the preventDefault…
Before I hand this to the payments reviewer, make the prevention clear: surface the preventDefault call next to where submission is decided, annotate the code path that leads to a programmatic submit, and flag any asynchronous validation that could let the default submit slip through.

Decide — diagnose the stuck moment

+
I added e.preventDefault in the checkout submit handler, but the page still navigates to the bank's…

the form still navigates away despite preventDefault

I added e.preventDefault in the checkout submit handler, but the page still navigates to the bank's redirect. I attached the handler to the submit button rather than the form and there's an inline onsubmit elsewhere. The payments lead needs this fixed now. What's the most likely reason preventDefault failed and the minimal code change to guarantee the browser won't perform the default navigation?

Become — change the pattern

+
We keep shipping forms where the default navigation happens because someone attached handlers to…

forgot preventDefault on delegated handlers

We keep shipping forms where the default navigation happens because someone attached handlers to buttons or relied on inline attributes. It breaks analytics and causes lost carts. What operational habit, review checklist item, and quick test should we adopt to ensure preventDefault is applied correctly every release?

Next to this one

Other programming language work people do in JavaScript.

Every task here came from the work, not from a feature list — which is why the prompts name what you want done and never the button that does it. The tool changes; the work does not.
Copyright © LLOS.ai · 2026 — original pedagogy, voice, and design — all rights reserved.

The rest of the map

Same library, five ways in.