如何选择表格行中的内部链接

Ale*_*eau 0 jquery jquery-selectors

当我将鼠标悬停在它上面时,我试图在html行中选择一个链接,我可能做错了.

这是我的HTML:

<table id="table-id">
<tr>
    <td>yeah</td>
    <td>some content</td>
    <td><a href="#" class="remove">delete</a></td>
</tr>
...
</table>
Run Code Online (Sandbox Code Playgroud)

和jQuery代码:

$('#table-id tr').hover(function(){
    $(this).children('.remove').show(); # I don't get the link in there
}, function(){
    $(this).children('.remove').hide(); # and thus not here neither
});
Run Code Online (Sandbox Code Playgroud)

这些链接隐藏在:

$('a.remove').each(function(){
    $(this).hide();
    $(this).click(function(){
        return confirm("are you sure?");
    });
});
Run Code Online (Sandbox Code Playgroud)

关于我在这里缺少什么的想法?

Uku*_*kit 5

直接的孩子trtd元素,因此它不起作用.你可以使用这样的东西:

  $('#table-id tr').hover(function(){
        $(this).children().find(".remove").show(); 
    }, function(){
        $(this).children().find(".remove").hide(); 
  });
Run Code Online (Sandbox Code Playgroud)

http://jsfiddle.net/R7vY5/