I have been using thymeleaf
th:onclick
attribute to call javascript
function with parameters as below
th:onclick="|myFunction('${parameter1}')|"
But with thymeleaf 3.1.10
this has been removed. and they are suggesting to use th:data
attribute.
I however found workaround on as below and both of them are working perfectly.
th:attr="onclick=|myFunction('${parameter1}')|"
th:onclick="@{myFunction('${parameter1}')}">
Now i am not sure if these workarounds are correct way to do things and if yes which one is the better way.
See Question&Answers more detail:os