Reputation: 135
I have a table in html, filled via a many items. The row's code is this:
<tr th:each="item : ${srcResults}">
<td th:text="${item.something}"style="vertical-align:middle;" />...
<td style="vertical-align: middle;">
<label class="btn btn-primary" title="Details" onclick="submitDetails(${item});">
<i class="fa fa-info" />
</label>
</td>
</tr>
and the javascript function that's called is:
submitDetails = function(item) {
console.log('I have been called');
};
But It does not work and chrome's console says
Uncaught SyntaxError: missing ) after argument list referring to the label tag.
I have to use the item object but I do not know how to pass it to the js function
Upvotes: 1
Views: 2016
Reputation: 529
try something like this
onclick="submitDetails('"+${item}+"');"
Upvotes: 2