Answer the question
In order to leave comments, you need to log in
How to implement an if condition on index 4 in html?
I don’t know how to find out the index of the iterated object in order to build a chain of conditions for the transition.
Example:
{% for i in table %}
<!-- Сюда 4 элемента-->
<div>
<!-- И сюда все остальные элементы -->
{%endfor%}
Answer the question
In order to leave comments, you need to log in
{% for i in table %}
{% if forloop.counter < 5 %}
<!-- Сюда 4 элемента-->
{% else %}
<!-- И сюда все остальные элементы -->
{% endif %}
{%endfor%}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question