相关疑难解决方法(0)

如何减少我在jQuery函数中使用的子项数量?

我觉得我必须.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函数中使用的子项数量?

html css jquery children

17
推荐指数
3
解决办法
1885
查看次数

标签 统计

children ×1

css ×1

html ×1

jquery ×1