Thymeleaf : passing javascript parameters

Another way - th:onclick="|confirmDelete('${company.id}')|"

Or if you want send several params across '_' use th:onclick="|confirmDelete('${type}_${company.id}')|"


The problem came from anchor, so please try this one if the confirmDelete() function require a string id

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

And if it need a number id

th:onclick="'javascript:confirmDelete(' + ${company.id} + ');'"