开发者

Jquery nextUntil and row cells

There is a html table with the following structure:

<table>
    <tr class="header">
        <td><img id="test_click" src=""></td>
        <td></td>
    </tr>
    <tr>
        <td></td>
        <td></td>
    </tr>
    <tr>
        <td></td>
        <td></td>
    </tr>
    <tr class="header">
        <td></td>
        <td></td>
        </tr>
    <tr>
        <td></td>
        <td></td>
    </tr>

How can i hide all table rows bet开发者_JAVA技巧ween two using jquery?

This code does not work as i suspected :(

$("#test_click").click(function(){
    $(this).parent().parent().nextUntil('tr.header').find('tr').hide(); 
});


nextUntill already selects your trs. No need to .find anything:

$("#test_click").click(function() {
    $(this).parent().parent().nextUntil('tr.header').hide();  
});

http://jsfiddle.net/nMBrw/

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜