⇧
vadnica-logo
My Services About the Project Telegram O meni O meni

Preventing Default Behavior with e.preventDefault()

The browser has a predefined default behavior for certain elements (e.g., clicking a link navigates to a new URL, submitting a form reloads the entire page). With the e.preventDefault() method, we stop this behavior, which allows us to validate data or send it in the background using JavaScript without any page refresh.

EXAMPLE
RESULT