I want to conditionally style elements by comparing two attributes.
- a url parameter 'customerID'
- a model attribute
th:each=" customer : ${customers}"
I want to change the background of a button if these two parameters are equal. I'm using inline styling with thymeleaf.
th:style="${param.customerID == customer.id ? 'background-color:green' : 'background-color:red'}"
but the result of the condition is always false even when the two arguments are equal.
<div class="user-list">
<div class="active-btn-group" id="active-button-group" th:each=" customer : ${customers}">
<p th:text="${param.customerID}">Test</p>
<p th:text="${customer.id}">Test</p>
<button th:id="${customer.id}" th:style="${param.customerID == customer.id ? 'background-color:green' : 'background-color:red'}">
</button>
</div>
</div>
How should I change the about inline formatting expression?