Skip to content

Instantly share code, notes, and snippets.

@rebelwarrior
Created February 12, 2018 00:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rebelwarrior/82fb4f6681d7d5d8bfc8f1c94715fbe4 to your computer and use it in GitHub Desktop.
Save rebelwarrior/82fb4f6681d7d5d8bfc8f1c94715fbe4 to your computer and use it in GitHub Desktop.
Simple DropDown in Elm
import Html exposing (..)
import Html.Attributes exposing (..)
import Html.Events exposing (on, targetValue)
main =
beginnerProgram { model = "", view = view, update = update }
view model =
div []
[ select [ on "change" Html.Events.targetValue ]
[ option [value "strawberry" ] [ text "strawberry" ]
, option [value "chocolate" ] [ text "chocolate" ]
, option [value "vanilla" ] [ text "vanilla" ]
]
, div [] [ text (toString model) ]
]
update msg model =
model ++ (toString msg)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment