JQuery在悬停时显示隐藏类

Bro*_*ke. 11 jquery class hover

我对JQuery比较陌生,我希望能够在mouseover上显示一个菜单.

这是html

<td class ="comment_div"> <?php echo("$comment_data['comment']); ?> <br/>
    <span class="comment_actions"> Approve | Delete | Spam | Edit</span>
</td>
Run Code Online (Sandbox Code Playgroud)

然后是JQuery

$("comment_div").hover(
    function() { $(".comment_actions").show(); },
    function() { $(".comment_actions").hide(); }
);
Run Code Online (Sandbox Code Playgroud)

这项工作是因为我将多个评论拉出来,这只会显示第一个div上的菜单,无论"评论"是什么.我想仅针对当前悬停的评论显示菜单.我想我需要使用"$ this"来完成这项工作但不确定如何.

谢谢.

Kel*_*ron 18

如果我正确阅读该格式应该是 -

$(".comment_div").hover(
  function() { $(this).children(".comment_actions").show(); },
  function() { $(this).children(".comment_actions").hide(); }
);
Run Code Online (Sandbox Code Playgroud)

编辑,因为我是一个完全白痴.