I need to make increment in area-controls boostrap taf with my list count. My code as under:
<th:block th:each="stateTitles, statesStatus: ${states}">
<a data-toggle="collapse" id="stateCollapsed" class="collapsed" data-parent="#accordion" th:href="'#collapse' + ${statesStatus.index + 1}"
aria-expanded="true" aria-controls="'collapse' + ${statesStatus.index + 1}">
<span id="state" th:text="${stateTitles}" />
<span class="glyphicon glyphicon-menu-down"></span>
<span class="glyphicon glyphicon-menu-up"></span>
</a>
</th:block>
Increment is not working for area-controls tag. Thanks in advance.
You need to use th:attr
in order to inject values using Thymeleaf, check documentation here.
So change the code to:
<a data-toggle="collapse" id="stateCollapsed" class="collapsed" data-parent="#accordion" th:href="'#collapse' + ${statesStatus.index + 1}"
aria-expanded="true" th:attr="aria-controls='collapse' + ${statesStatus.index + 1}">
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With