如何在列出的项目项目的显示列表的django中保存具有背景色的选择项目,我试图使用javascript queryselectors,但是它一直选择带有绿色背景的第一个项目项目,表明该项目已被采用,我希望完成此操作,但是单击一个特定的项目ID会将其背景更改为绿色,以表明该项目已经存在。愿意接受建议,不知道自己在做什么错事
{% if latest_question_list %}
{% for question in latest_question_list %}
<div class="container">
<div class="row example" id="posted-projects">
<div class="col-sm-2 text-center">
<img src="{% static 'img\profile.png' %}" width="60"/>
</div>
<div class="col-sm-2 text-center">
<br>
<a href="" class="btn btn-default btn-sm btn-block"><span class="glyphicon glyphicon-pencil"></span> Edit</a>
<br>
</div>
<div class="col-sm-2">
<br>
<button type="button" class="btn btn-default btn-sm btn-block"><span class="glyphicon glyphicon-trash"></span> Remove</button>
</div>
<div class="col-sm-2">
<br>
<button onclick="myFunction()" type="button" class="btn btn-default btn-sm btn-block"><span class="glyphicon glyphicon-briefcase"></span> Take Project</button>
</div>
<div class="col-sm-4">
<br>
<a class="btn btn-default btn-sm btn-block" href="{% url 'explore:detail' question.id %}">{{ question.question_text }}</a>
<br>
</div>
</div>
</div>
{% endfor %}
{% else %}
<p>No project are available.</p>
{% endif %}