Kevin Lewis
Kevin Lewis

Reputation: 1085

Iteration to add class in Jade

Here is what I have so far in my hello.jade file, I am aware that it is not finished, but I have no idea how to proceed.

for challenge in ["talks", "books", "blog"]

Here's what I would like in the output

<div class="talks"></div>
<div class="books"></div>
<div class="blog"></div>

So far, I am unable to find a way to use iteration to manipulate classes in Jade. Is this even possible? Thanks in advance.

Upvotes: 1

Views: 576

Answers (1)

adamK
adamK

Reputation: 3889

You can use the class attribute instead of the period shortcut like this:

for challenge in ["talks", "books", "blog"]
    div(class=challenge)

Upvotes: 3

Related Questions