Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
import Html exposing (Html, Attribute, text, div, input)
import Html.App exposing (beginnerProgram)
import Html.Attributes exposing (..)
import Html.Events exposing (onInput, on)
import String
main =
beginnerProgram { model = "", view = view, update = update }
type Msg
= NewContent String
| NoOp
update msg oldContent =
case msg of
NewContent content ->
NoOp ->
view content =
input [ type' "number", onInput handleInput, value content ] []
handleInput : String -> Msg
handleInput s =
if String.length s <= 2 then NewContent s else NoOp
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment