[this page | pdf | back links]
The preventDefault() method (when applied to
an event if it is cancellable (i.e. it causes the default action belonging to
the event not to occur).
For example, this could
stop the browser from going to a new page when a link is clicked.
Note: Not all events are
cancellable; the event.cancelable
property will indicate whether it is cancellable. Also, the preventDefault() method does not
prevent further propagation through the DOM; to limit this, use the event.stopImmediatePropagation()
has the following syntax with no parameters. It does not return a value.