I have a javascript object in my jade view like this :
element = {
name: 'createdAt',
type: 'text',
attrs: {
class: 'date',
type: 'text',
placeholder: 'Created at'
}
}
I would like generate attributes on an input tag, trying something like this
input(
each k, v in element.attrs
k= v
)
Of course this doesn't work, I also tried some inline code but without success. Do you have any idea to help me ?
From documentation:
Pronounced "and attributes", the &attributes syntax can be used to explode an object into attributes of an element.
div#foo(data-bar="foo")&attributes({'data-foo': 'bar'})
http://jade-lang.com/reference/attributes/#and-attributes
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With