Variable expression into javascript without using th:inline

前端 未结 6 971
广开言路
广开言路 2020-12-10 04:41

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

6条回答
  •  刺人心
    刺人心 (楼主)
    2020-12-10 05:17

    This one worked:

    th:onclick="'javascript:getContactId(\'' + ${contact.id} + '\');'"
    

    Thanks goes out to the thymeleaf forum: http://forum.thymeleaf.org/variable-expression-into-javascript-without-using-th-inline-td4025534.html

提交回复
热议问题