Skip to content

Can't use string in event attributes #973

Closed Answered by pharrisee
MilkeeyCat asked this question in Q&A
Discussion options

You must be logged in to vote

To get even more subversive this also works:

<div { templ.Attributes{"onclick":fmt.Sprintf("doIt(%d)",11)}... }>
   <p>click me</p>
</div>

The more ways I find of misusing templ.Attributes the dirtier I feel.

Replies: 2 comments 3 replies

Comment options

You must be logged in to vote
2 replies
@joerdav
Comment options

@pharrisee
Comment options

Comment options

You must be logged in to vote
1 reply
@MilkeeyCat
Comment options

Answer selected by MilkeeyCat
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants