问题描述
我得到了以下代码
<% topic.forEach(function(topic){ %>
<div class="col-4">
<div id="homecard" class="card" style="width: 18rem;">
<a href="/home/<%= topic._id %>"><img class="card-img-top" src="<%= topic.image %>" alt="Card image cap"></a>
<div class="card-body">
<span id="homecategory" class="card-title"><%= topic.category %></span>
<p id="homesubject" class="card-text text-center mt-3"><%= topic.subject %></p>
</div>
</div>
</div>
<% }); %>
<script>
var card = $("#homecard");
card.forEach(function(card){
$(this).click(function(){
console.log("done");
});
})
</script>
ejs代码通过在另一张卡中使用过一次快速打印来打印从mongoos数据库获取的信息。
我想循环扔掉所有卡片,并使用Jquery做一些事情,但我不能,因为它只能识别第一张卡片。
如果任何人都可以帮助并找到一种循环循环的方法,将它们全部扔掉。
谢谢。
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)