thymeleaf a标签 执行 onclick 事件传参数 的写法

thymeleaf a标签 执行 onclick 事件传参数 的写法:

<a href = "javascript:void(0)"
                   th:onclick = "|javascript : toDeleteUser( '${ user.id }' )|" >删除</a>

或者

<a href = "javascript:void(0)"
                   th:onclick = "'javascript : toDeleteUser(\'' + ${ user.id } + '\')'" >删除</a> 

或者 用 button 标签:

<button class="btn btn-small btn-link" type="button"
                   th:onclick = "|javascript : toDeleteUser( '${ user.id }' )|" >删除</button>

传递两个参数,th:onclick 写成这样, = =

th:onclick= "'javascript:goRead( \''+${item.id}+'\', \''+${cartoon.id}+'\' )'"

猜你喜欢

转载自blog.csdn.net/beguile/article/details/86554497
今日推荐