# HTML5 events example

This example demonstrates registering for HTML5 events in Erlang.

It focuses on events that can be registered on a target. Events are registered on the window, the document and the input field when the corresponding checkbox is checked, and unregistered when it is unchecked.

This example also demonstrates usage of user data, which can be used to refer to the target element. Events are registered on window with no user data, on document with `document` as atom and on input field with a binary. See source code for more details.

Touch events require a browser with a touch interface. If you are using provided `wasm_webserver` sample web server, you can only access this website on localhost as Wasm samples only work over HTTPS or on localhost. You can nevertheless use iOS simulator on macOS to test touch interfaces or setup a web server with HTTPS and the proper headers.

Input field
Key events keypress keyup keydown
Mouse events click mousedown mouseup dblclick mousemove mouseenter mouseleave mouseover mouseout
Wheel events wheel
UI events resize scroll
Focus events blur focus focusin focusout
Touch events touchstart touchend touchmove touchcancel

## Event log

# | Event | Timestamp | Event map | User data