Hello Razvan,

Use domina - https://github.com/levand/domina#registering-event-listeners

Add an ID or class (if several buttons) and listen for click

(listen! (sel "button") :click (fn [evt] (log "button clicked!")))


Best regards,
Eduard


On Sun, Jun 15, 2014 at 12:31 AM, Răzvan Rotaru <[email protected]> wrote:
> Hi,
>
> I'm playing around with crate (https://github.com/ibdknox/crate), a hiccup 
> implementation for clojurescript, and I'm having a hard time adding event 
> listeners to dom nodes. It seems like I must provide the compiled function to 
> crate. For example
>
> [:button {:onclick #(js/alert "123")}]
>
> will be rendered as
>
> <button onclick="function() {return alert('123');}" />
>
> which, of course does not do anything. It seems like I must call the cljs 
> compiler here, but that does not seem right. Does anybody have an idea how to 
> (correctly) solve this problem? I'm sure the dom libraries have solved this 
> (domina, dommy), but I could figure out how.
>
> Razvan
>
> --
> Note that posts from new members are moderated - please be patient with your 
> first post.
> ---
> You received this message because you are subscribed to the Google Groups 
> "ClojureScript" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/clojurescript.

-- 
Note that posts from new members are moderated - please be patient with your 
first post.
--- 
You received this message because you are subscribed to the Google Groups 
"ClojureScript" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/clojurescript.

Reply via email to