简体   繁体   English

玉 - 创建多个html元素

[英]jade - create multiple html elements

I want to create multiple elements having the same class with jade. 我想用jade创建具有相同类的多个元素。 Is this possible? 这可能吗? It should be something like this: 它应该是这样的:

3 times do
  insert div.className

Thank you in advance! 先感谢您!

Multiple elements can share a single class without issue, just as in standard HTML. 多个元素可以毫无问题地共享单个类,就像在标准HTML中一样。 That's one of the underlying differences between a class and ID, though there is some other differentiation. 这是类和ID之间的潜在差异之一,尽管存在一些其他区别。

An easy way to do this is using a traditional JavaScript for-loop incorporated into your Jade template. 一种简单的方法是使用传统的JavaScript for循环并入您的Jade模板。

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

or (obviously) 或(显然)

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM