Take a look at onEnter from elm-todomvc:

https://github.com/evancz/elm-todomvc/blob/master/Todo.elm#L237

On Sat, 3 Dec 2016, 22:11 Brian Marick, <[email protected]> wrote:

> (Disclaimer: I didn’t come to Elm knowing Javascript.)
>
> Anyone know of a source for code that sends a message when the user
> presses enter in a particular text input field? I could write the code -
> eventually - but it looks to be awfully fiddly and something that a zillion
> people must have done already.
>
> ——
>
> To be specific:
>
> I have the following controls on a page. When the `Add` button is clicked,
> it causes a new tag to appear in the list of tags. I want Enter to do the
> same thing.
>
>
> That is, I think I need code to put in what is currently this:
>
>         input [ class "input"
>               , type' "text"
>               , value (tentativeTag animal)
>               , Events.onInput (SetTentativeTag animal.id)
>               , .. call magic event function here ...
>               ]
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Elm Discuss" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups "Elm 
Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to