The th:classappend Themeaf tag is usually used to do this. Supose we have a hiperlink, now how to dynamically add or remove CSS in that link. If user value is avilable then we add userclass(CSS) other then notuserclass(CSS)
<a href=""
class="otherclassname" th:classappend="${isUser} ? userclass: notuserclass"></a>
If isUser modelView value is true, then
result will be:
<a href=""
class="otherclassname userclass"></a>
No comments:
Post a Comment