简体   繁体   中英

Call a Javascript function from jstl foreach

I am iterating over a list in JSTL to show its records. There is onclick="editList()" event on each <form:label . I want to send both ${item.id} and ${item.number} in the editList() function parameters if any of them is clicked. How can I send these parameters.

<c:forEach var='item' items='${rule.list}' varStatus="itemsRow">
 <tr>
    <form:label path="list[${itemsRow.index}].id" onclick="editList()">
     ${item.id}
    </form:label>
 </tr>
 <tr>
    <form:label path="list[${itemsRow.index}].number" onclick="editList()">
     ${item.number}
    </form:label>
 </tr>
</c:forEach>
onclick="editList('${item.id}', '${item.number}')"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM