jQuery Event - preventDefault() Method
Example
Prevent links from opening URL:
$("a").click(function(event){ event.preventDefault(); });
Definition and Usage
The preventDefault() method prevents the element from performing its default behavior (for example, preventing form submission when clicking a submit button).
Syntax
event.preventDefault()
Parameter | Description |
---|---|
event | Required. Specifies which default action to prevent. This event Parameters come from the event binding function. |