我觉得我必须在我的一些 jQuery 函数中使用太多.children()
。
这是我的 HTML:
<div class="goal-small-container">
<div class="goal-content">
<div class="goal-row">
<span class="goal-actions">
这是我的 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"});
});
有没有更好的办法?如何减少我在 jQuery 函数中使用的子项数量?