Reputation: 477
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
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