ExamplePrevent a link from opening the URL:
Try it yourself » |
The preventDefault() method stops the default action of an element from happening (for example, preventing a form being submitted when a submit button is clicked).
event.preventDefault() |
Parameter | Description |
---|---|
event | Required. Specifies the event to prevent the default action for. The event parameter comes from the event binding function |