Below code in thymeleaf template view is calling javascript function filter:
<select th:onchange="'filter(this, \'' + ${#lists.size(books)} + '\');'">
<option value="all" selected="selected">All Books</option>
<option value="fav">My Favourite</option>
</select>
But, ${#lists.size(books)} is prefixed and suffixed with ' as shown in the view-source:
<select onchange="filter(this, '1');">
<option value="all" selected="selected">All Books</option>
<option value="fav">My Favourite</option>
</select>
How to remove ' from javascript function call in Thymeleaf?
\''and then'\'. That is definitely not right. Do you mean'\'in both?