diff options
Diffstat (limited to 'elm/Lib/Html.elm')
-rw-r--r-- | elm/Lib/Html.elm | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/elm/Lib/Html.elm b/elm/Lib/Html.elm index 1e995f86..66436073 100644 --- a/elm/Lib/Html.elm +++ b/elm/Lib/Html.elm @@ -79,6 +79,20 @@ inputSelect nam sel onch attrs lst = ) <| List.indexedMap opt lst +inputNumber : String -> Int -> (Int -> m) -> List (Attribute m) -> Html m +inputNumber nam val onch attrs = input ( + [ type_ "number" + , class "text" + , tabindex 10 + , style "width" "40px" + , value <| String.fromInt val + , onInput (\s -> onch <| Maybe.withDefault 0 <| String.toInt s) + ] + ++ attrs + ++ (if nam == "" then [] else [ id nam, name nam ]) + ) [] + + inputText : String -> String -> (String -> m) -> List (Attribute m) -> Html m inputText nam val onch attrs = input ( [ type_ "text" |