Yes, th:attr for help Thymeleaf Documentation - Setting attribute values .
For your scenario, this should complete the task:
<div th:attr="data-el_id=${element.getId()}">
XML rules do not allow you to set an attribute twice in a tag, so you cannot have more than one th:attr in the same element.
Note. If you want more than one attribute, separate the different attributes with a comma:
<div th:attr="data-id=${element.getId()},data-name=${element.getNββame()}">
Aldrian Jun 26 '14 at 2:04 a.m. 2014-06-26 14:04
source share