Skip to content

Instantly share code, notes, and snippets.

@AntouanK
Created January 21, 2018 18:08
Show Gist options
  • Save AntouanK/31144f4332ed973e0c702e7d9cfa6152 to your computer and use it in GitHub Desktop.
Save AntouanK/31144f4332ed973e0c702e7d9cfa6152 to your computer and use it in GitHub Desktop.
onChange event handler for Elm
import Html exposing (Attribute)
import Json.Decode as Json
onChange : (String -> msg) -> Attribute msg
onChange handler =
on "change" <| Json.map handler <| Json.at ["target", "value"] Json.string
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment