Attributes

Jade attributes are written inside parentheses after an element.

a(href="/about") About us

Multiple attributes can be written together:

input(type="email" name="email" placeholder="Email address")

Dynamic attributes

Attribute values can come from JavaScript expressions.

a(href=user.profileUrl) View profile

Conditional attributes

button(class=isPrimary ? "primary" : "secondary")
  | Continue

Boolean attributes

Boolean HTML attributes can be controlled with JavaScript values.

input(type="checkbox" checked=isSelected)

Classes

Classes can be supplied dynamically:

- var buttonClasses = ["button", "primary"]

button(class=buttonClasses) Continue

IDs

section(id=sectionId)

Attribute objects

Jade also supports applying an object of attributes to an element.

- var classes = ['foo', 'bar', 'baz']
a(class=classes)
//- the class attribute may also be repeated to merge arrays
a.bing(class=classes class=['bing'])

When using dynamic or unescaped attributes, validate data that originates from users.

Jade Language © 2026 | About Us | Privacy Policy