Target first level
  • s and not the nested
  • s
  • 后端 未结 6 1128
    无人共我
    无人共我 2020-12-07 19:51

    I have the following HTML:

    • A
      • subsection
    • B <
    6条回答
    •  庸人自扰
      2020-12-07 20:35

      You could do this:

      $('ul > li:not(:has(ul))');
      

      But it would be better to give your top level

        an ID so you can target it with a valid CSS selector:

        $('#topUL > li')
        

    提交回复
    热议问题