omarloren
omarloren

Reputation: 133

Cant put id to div from variable Jade

I have the following in my Jade view:

- var items = "one"
each item in items
  div(id= #{items})

what I want is:

<div id="one"></div>

but Jade renders:

<div id="undefinedoneundefined"></div>

this is driving me crazy, I'm using Jade with Express.js.

BTW I've asked something similar but less clear, hope not to annoy anyone with my silliness.

Upvotes: 8

Views: 7847

Answers (1)

David Weldon
David Weldon

Reputation: 64312

Something like this?

- var items = ["one", "two", "three"]
each item in items
  div(id= item)

Upvotes: 18

Related Questions