![]() |
VOOZH | about |
The preventDefault() method is used to prevent the browser from executing the default action of the selected element. It can prevent the user from processing the request by clicking the link.
event.preventDefault()It does not accept any parameter. The event is used to denote the event or action by the user in the response to which the method works.
Example: This code will prevent the browser from going to another page.
Output:
Example: This code will prevent the browser from redirecting the page to another PHP file.
Output: