码迷,mamicode.com
首页 > Web开发 > 详细

jquery遍历table

时间:2015-11-12 01:16:28      阅读:189      评论:0      收藏:0      [点我收藏+]

标签:

<html>
<head>
    <meta charset="UTF-8">
    <title>Document</title>
    <script src="js/jquery-1.11.3.min.js"></script>
</head>
<body>
<table id="tb">
    <tr id="1">
        <td class="name">akon</td>
        <td class="phone">111111</td>
    </tr>
    <tr id="2">
        <td class="name">john</td>
        <td class="phone">222222</td>
    </tr>
    <tr id="3">
        <td class="name">tom</td>
        <td class="phone">333333</td>
    </tr>
</table>

<script>
    var trList = $("#tb").find("tr");
    for(var i=0; i<trList.length; i++) {
        alert($(trList[i]).children(".name").text());
    }
</script>
</body>
</html>

 

jquery遍历table

标签:

原文地址:http://www.cnblogs.com/aoun/p/4957747.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!