wonderbummer
wonderbummer

Reputation: 477

jade - create multiple html elements

I want to create multiple elements having the same class with jade. Is this possible? It should be something like this:

3 times do
  insert div.className

Thank you in advance!

Upvotes: 3

Views: 1290

Answers (1)

Tejas Manohar
Tejas Manohar

Reputation: 974

Multiple elements can share a single class without issue, just as in standard HTML. That's one of the underlying differences between a class and ID, though there is some other differentiation.

An easy way to do this is using a traditional JavaScript for-loop incorporated into your Jade template.

- for(var x = 0;X < 3;x++) .nameOfClass

or (obviously)

- for(var x = 1;x <= 3;x++) .nameOfClass

Upvotes: 10

Related Questions