代码之家  ›  专栏  ›  技术社区  ›  CyberSynth

在JSFIDLE代码中,我无法将含义赋予符号“>”

  •  2
  • CyberSynth  · 技术社区  · 6 年前

    我在JSFIDLE中遇到了以下代码:

    $("#start").click(function()
         $("#bg > 
    img").addclass('animate');
    ));
    

    >的含义是什么;在第二行代码中?

    1 回复  |  直到 6 年前
        1
  •  1
  •   jeprubio    6 年前

    是一个 css selector .

    >是 child combinator 并选择直系子级。

    在您的示例中 img公司 是id为“”的元素的直接子代(直接子代) bg公司 “”将被选中。