Added Data attribute function
This commit is contained in:
parent
328e865231
commit
c9d9cc59bc
@ -12,7 +12,7 @@ func main() {
|
||||
h.Div()(
|
||||
h.Img(h.Src("./me.jpg"), h.Id("profile-photo")),
|
||||
h.Text("hello hatmill!"),
|
||||
h.Div(h.Disabled())(),
|
||||
h.Div(h.Disabled(), h.Data("coolness", "awesome"))(),
|
||||
),
|
||||
),
|
||||
)
|
||||
|
@ -122,3 +122,11 @@ func WriteDocument(w io.Writer, root *ParentElement) (n int64, err error) {
|
||||
n += nroot
|
||||
return
|
||||
}
|
||||
|
||||
// Data creates an attribute of the form "data-suffix='value'".
|
||||
func Data(suffix, value string) Attrib {
|
||||
return Attrib{
|
||||
Key: "data-" + suffix,
|
||||
Value: value,
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user