Variable expression into javascript without using th:inline

前端 未结 6 969
广开言路
广开言路 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:18

    You can do this like:

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

提交回复
热议问题