Element.Events

The only difference is that the HTML.Events are turned into Element.Events

Mouse Helpers

onClick : msg -> Attribute variation msg

onDoubleClick : msg -> Attribute variation msg

onMouseDown : msg -> Attribute variation msg

onMouseUp : msg -> Attribute variation msg

onMouseEnter : msg -> Attribute variation msg

onMouseLeave : msg -> Attribute variation msg

onMouseOver : msg -> Attribute variation msg

onMouseOut : msg -> Attribute variation msg

Form Helpers

onInput : (String -> msg) -> Attribute variation msg

Capture input
events for things like text fields or text areas.
It grabs the string value at event.target.value, so it will not work if
you need some other type of information. For example, if you want to track
inputs on a range slider, make a custom handler with on.
For more details on how onInput works, check out targetValue.

onCheck : (Bool -> msg) -> Attribute variation msg

Capture change
events on checkboxes. It will grab the boolean value from event.target.checked
on any input event.
Check out targetChecked for more details on how this works.

onSubmit : msg -> Attribute variation msg

Capture a submit
event with preventDefault
in order to prevent the form from changing the page’s location. If you need
different behavior, use onWithOptions to create a customized version of
onSubmit.

Focus Helpers

onBlur : msg -> Attribute variation msg

onFocus : msg -> Attribute variation msg

Custom Event Handlers

on : String -> Json.Decoder msg -> Attribute variation msg

Create a custom event listener. Normally this will not be necessary, but
you have the power! Here is how onClick is defined for example:

Options for an event listener. If stopPropagation is true, it means the
event stops traveling through the DOM so it will not trigger any other event
listeners. If preventDefault is true, any built-in browser behavior related
to the event is prevented. For example, this is used with touch events when you
want to treat them as gestures of your own, not as scrolls.

defaultOptions : Options

Everything is False by default.

defaultOptions =
{ stopPropagation = False
, preventDefault = False
}

Custom Decoders

targetValue : Json.Decoder String

A Json.Decoder for grabbing event.target.value. We use this to define
onInput as follows: