-
Notifications
You must be signed in to change notification settings - Fork 35
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Question: Elem.button - onClick? #62
Comments
Hi Jan, Thanks for reaching out. As you have discovered, the "onClick" attribute doesn't exist in the Before I leave some example code, I just want to point out that the F# lamba as you have it will not work. The module Attr =
let onclick v = Attr.create "onclick" v
Elem.button [ Attr.onclick "(function() { console.log('here') })()" ] [ Text.raw "Click" ]
// Equivalent to: <button onclick="(function() { console.log('here') })()">Click</button> Let me know if that makes sense, or if you have any other questions. Cheers |
Hello Pim, thank you for reply. I was aware that lambda wont work it was just for illustration. It is reasonable. If I wanted javascript onClick then I add an id to the element using Attr.id reference .js file and assign onClick event there. What I was originally after was a button that redirects user, but I used Elem.a masked by bootstrap as button with href. I like Falco very much so far thank you for creating it. :) |
Appreciate that! Glad you enjoy it! Tell your friends! |
Hello,
how do I assign function to button's onClick in Falco?
I am attempting something like: let button = Elem.button [ Attr.onClick (fun _ -> xxxx) ] [ ]
but it does not exist. I was looking into Falco source code for something like onClick but I have not found anything.
The text was updated successfully, but these errors were encountered: