Created
January 21, 2018 18:08
-
-
Save AntouanK/31144f4332ed973e0c702e7d9cfa6152 to your computer and use it in GitHub Desktop.
onChange event handler for Elm
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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