An event is a signal from the browser that something has happened.
This section covers properties and specials of mouse-related events.
The focus event triggers when a visitor focuses on an element.
Not all elements are focusable by default. For example, INPUT and all types or form fields support this event, A supports it. As a counterexample, DIV doesn’t support focus.
Keyboard events is one of wilder parts of frontend development. There are inconsistencies and cross-browser problems.
But still there are recipes which help to cope with ordinary situations easily.
The event object is always passed to the handler and contains a lot of useful information what has happened.
DOM elements can be nested inside each other. And somehow, the handler of the parent works even if you click on it’s child.
The reason is event bubbling.
A browser has its own “default” behavior for certain events.
The content of this site is available under the terms of CC BY-NC-SA.
© Ilya Kantor, 2011.