Prevent a link from opening the URL:
The event.preventDefault() method stops the default action of an element from happening.
For example:
Tip: Use the event.isDefaultPrevented() method to check whether the preventDefault() method was called for the event.
| Parameter | Description |
|---|---|
| event | Required. The event parameter comes from the event binding function |
Your message has been sent to W3Schools.