I searched first but I found confusing answers since I\'m new to Thymeleaf and amateurish at best at javascript.
I just want to know how to pass variable expressions
You can not put javascript variables into onclick or other DOM attributes. The value of onclick or any other DOM attribute should be a constant string.
javascript
onclick
However, you can dynamically modify value of onclick attribute from javascript, like this:
yourDomElement.onclick = anyVariable;