Inline HTML example: th:onclick="${'myFunction(' + id + ');'}" First, we'll create a web controller with a GET endpoint that returns a page with a list of Baeldung articles. You can do something like this : . If you don't need any dynamic vars in the JS function call, this is how to do it: th:onclick="'alert(\'a\');'" This simply escapes the single quotes and requires no SpringEL (of … Let's first create a simple controller that … Thymeleaf onclick send td value to javascript function - CMSDK Thymeleaf evaluates the expression and assigns the value to a variable. To facilitate it, we need to use th:inline="javascript" as an attribute in