Code Review

Why not put `event.preventDefault()` at the top since its done in both if and else?