我觉得我必须.children()在一些jQuery函数中使用太多.
这是我的HTML:
<div class="goal-small-container">
<div class="goal-content">
<div class="goal-row">
<span class="goal-actions">
Run Code Online (Sandbox Code Playgroud)
这是我的jQuery:
$('.goal-small-container').hover(function() {
$(this).children('.goal-content').children('.goal-row').children('.goal-actions').css({visibility: "visible"});
}, function () {
$(this).children('.goal-content').children('.goal-row').children('.goal-actions').css({visibility: "hidden"});
});
Run Code Online (Sandbox Code Playgroud)
有没有更好的办法?如何减少我在jQuery函数中使用的子项数量?