In my current spring-boot project, I have one view with this html code:
<button type="button" class="btn btn-primary" onclick="upload()" th:utext="#{modal.save}"></button>
in the onclick
attribute, the call for the function upload()
should have one parameter, which value is stored in the thymeleaf variable ${gallery}
.
Anyone can tell mehow to use the expression in the above command?
I already try this:
th:onclick="upload(${gallery)"
th:attr="onclick=upload(${gallery)"
None of this worked.
I solve this issue with this approach:
th:onclick="|upload('${command['class'].simpleName}', '${gallery}')|"