html 循环数据单个获取

使用场景:点击获取当前列表某行的Id,跳转详情

html

 <tr class="worksheetInfo" th:each="worksheetOne,worksheetOneStat:${worksheetDto}" id="worksheetInfo">
                <td class="table_td1" th:text="${worksheetOne.worksheetId}">worksheetOne.worksheetId</td>
</tr>



js

$(".worksheetInfo").each(function(index){
    $(this).click(function(){
        var worksheetId = $('.table_td1').eq(index).text();
        window.location.href = "/workflow/worksheetInfo?worksheetId=" + worksheetId;
    })
})

猜你喜欢

转载自blog.csdn.net/sicily_winner/article/details/80001074