Preventing browser actions
There are two ways to tell the browser we don’t want it to act:
- The main way is to use the
eventobject. There’s a methodevent.preventDefault(). - If the handler is assigned using
on<event>(not byaddEventListener), then returningfalsealso works the same.
Returning false from a handler is an exception
The value returned by an event handler is usually ignored.
The only exception is return false from a handler assigned using on<event>.
In all other cases, return value is ignored. In particular, there’s no sense in returning true.
