jquery获取表格每一行数据


<table class="table">
    <tr>
        <th>ID</th>
        <th>描述</th>
        <th>操作</th>
    </tr>

    <tr th:each="question:${questions}">
        <td th:text="${question.id}"></td>
        <td th:text="${question.description}"></td>
        <td>
            <button id="suppId" type="button" class="btn btn-primary supp">提交</button>
        </td>
    </tr>
</table>

  

获取每一行的“描述”的值

<script>
        $(function () {
            $(".btn.btn-primary.supp").click(function () {
                var desc= $(this).parent().parent().find('td').eq(1).html();
                alert(desc);
            })
        })
</script>

  


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM