I have the following code:
{{range . }}
<td {{ if not .IsDisabled }}onclick="return toggle_active($(this))"{{ end }}>
[x]
</td>
{{end}}
This works, it puts the onclick event like it should.
However, if I try to create the onclick event dynamically as a string (either in the template, or as a Go function, it doesn't work.
Example:
{{$clickEvent := "return toggle_active($(this));"}}
<td {{$clickEvent}}>[x]</td>
Or:
func (d TemplateObject) Click() string {
return "onclick=\"toggle_active($(this))\""
}
<td {{.Click}}>[x]</td>
It renders it like this in the HTML:
If I don't put it in the <tag> itself <td>{{$ClickEvent}}</td> it prints it as a string.
How can I get the attribute to render correctly?
