开发者

search for innerHTML value in a table

how can I search in a table for a row with a specifik innerHTML value?

<table>
<tr><td>test</td><td>100</td></tr>
<tr><td>test</td><td>200</td></tr>
<tr><td>test</td><td>300</td></tr>
</table>

I need the index for the row (tr) where the second td is 200

here the index has to give 1

$('table tr'). something??

EDIT:

and I also need a version that select the index before a give value is bigger (asc) than 200 (i开发者_开发技巧f it exists)


$("TABLE TR").each(function() {
    if ($("TD", this).eq(1).html()== "200") {
        // Your logic here

        return false; // break out of .each() loop
    }
});


var ind = $('table tr:contains(200)').index();

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜