克隆一个 div 两次
我基本上是在尝试克隆一个已经存在于页面上的 div 两次。这就是我想要克隆的内容:
<div class="tnt-zombies">
//code in here
</div>
我还需要在一个克隆的 div 上设置一个增强类,在第二个克隆上设置一个高级类。我还想为这两个克隆添加一个克隆类,这样当我删除它们时,我可以调用克隆类。
我想要的最终结果是这样的:
<div class="tnt-zombies">//other code in here</div>
<div class="tnt-zombies cloned enhanced">//other code in here</div>
<div class="tnt-zombies cloned premium">//other code in here</div>
我希望这是有道理的。
I'm basically trying to clone a div that already lives on the page, two more times. Here's what I want to clone:
<div class="tnt-zombies">
//code in here
</div>
I need to also had a class of enhanced on one cloned div and a class of premium on the second clone. I will also want to add a class of cloned to each of those two clones so when I go to remove them, I can just call the class of cloned.
The end result that I would like to have is this:
<div class="tnt-zombies">//other code in here</div>
<div class="tnt-zombies cloned enhanced">//other code in here</div>
<div class="tnt-zombies cloned premium">//other code in here</div>
I hope that makes sense.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
试试这个:
小提琴:http://jsfiddle.net/maniator/Arzmm/
Try this out:
Fiddle: http://jsfiddle.net/maniator/Arzmm/
您也可以一次性完成此操作:
You could also do this in a single pass: