JavaScript event.preventDefault() Method
JavaScript event.preventDefault() Method
The event.preventDefault()
method cancels the event if it is cancelable, i.e., the default action of the event should not be taken as it normally would be.
Note: The event.preventDefault()
method does not prevent further propagation of an event. Use the event.stopPropagation() or event.stopImmediatePropagation(), either of which terminates propagation at once.
Note: This method will have no effect for a non-cancelable event, such as one dispatched via element.dispatchEvent(), without specifying cancelable: true.
Example
Syntax
Reminder
Hi Developers, we almost covered 97% of JavaScript Tutorials with examples for quick and easy learning.
We are working to cover every Single Concept in JavaScript.
Please do google search for:
Join Our Channel
Join our telegram channel to get an instant update on depreciation and new features on HTML, CSS, JavaScript, jQuery, Node.js, PHP and Python.
This channel is primarily useful for Full Stack Web Developer.