use thymeleaf variable in javascript code example
Example 1: use thymeleaf variable in javascript
<script th:inline="javascript"> // Enable Thymeleaf inlining
var email = [[${user.email}]]; // Behaves just like in HTML
</script>
Example 2: how to create a variable in thymeleaf
You can use local variables. Declare an HTML element with a th:with attribute. For example <div th:with="someVariable=${someValue}"