2 回答
TA贡献1840条经验 获得超5个赞
问题是您有多个具有相同 ID 的元素(演示)。您需要以某种方式区分这些元素。我会使用loop.index
{% for job in jobs%}
<div class="card w-100 mb-2">
<div class="jobs card-body">
<h5 class="card-title">Position: {{ job.title }}</h5>
<h6 class="card-title font-weight-normal">Location: {{ job.location }}</h6>
<p class="card-text">With supporting text below as a natural lead-in to additional content.</p>
<button type="button" class="btn btn-info" data-toggle="collapse" data-target="#demo-{{loop.index}}">Read More</button>
<a href="#" class="btn btn-primary">Apply</a>
<div id="demo-{{loop.index}}" class="collapse">
<hr>
<h6 class="">Requirements</h6>
Lorem ipsum dolor sit amet, consectetur adipisicing elit,
sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
</div>
</div>
</div>
{% endfor%}
TA贡献1789条经验 获得超8个赞
我假设它与所有被标记为演示的东西有关。
<button type="button" class="btn btn-info" data-toggle="collapse" data-target="#demo" >阅读更多</button>
<div id="demo" class="collapse">
我对神社没有经验也许你可以添加类似的东西data-target="#content{{job.id}}"
<div id="content{{job.id}}"
添加回答
举报